Sorry about the unhelpful thread title, I really can't think of a way to express my question 5 or six words. I'm making a little video game, what I want is for bananas to come up from the bottom and go to the top, or start at the top and go to the bottom, etc, what I don't want is have to make a seperate sprite for each and every banana. I dont want to tell to just go from top to bottom and repeat, because the goal of the game is going to be to catch the bananas, not just sit in one spot and rack up points.
Any suggestions?
Offline
You only need sprites for the number of bananas that are going to be on the screen at any one time. After a banana is caught or gets to the edge, you hide it and put it back to the begining area, with some randomness to the X coordinate so that it doesn't do the same thing every time. I'm sure there are some good examples out there, if I can find them, I'll post you a link.
Offline
Try this: [blocks]
<when green flag clicked>
<hide>
<go to x <pick random(-225 )to( 225)y:(218
<show>
<forever>
<repeat until><( <y position> <<>-210 )>
<change y by( -1
<end>
<hide>
<go to x <pick random(-225 )to( 225)y:(218
<show>
<end>
[/blocks]
That should do!
P.S.
If you're wondering about the y:(218 it's because otherwise I get y 218
Last edited by Llamalover (2008-02-01 09:44:50)
Offline
Well, here's one that not only uses random positioning, but it has bananas! It also has a lot of code scraps littering things up but just ignore those.
http://scratch.mit.edu/projects/hilly1/31114
Offline