This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-02-01 09:13:40

whosoever
Scratcher
Registered: 2008-01-31
Posts: 1

please help

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

 

#2 2008-02-01 09:30:46

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: please help

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.


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-02-01 09:39:04

Llamalover
Scratcher
Registered: 2007-05-18
Posts: 100+

Re: please help

Try this: [blocks]
<when green flag clicked>
<hide>
<go to x sad  <pick random(-225  )to( 225)y:(218
<show>
<forever>
    <repeat until><( <y position> <<>-210  )>
<change y by( -1
<end>
<hide>
<go to x sad  <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 sad  218

Last edited by Llamalover (2008-02-01 09:44:50)


Be nice, I'm an old lady  wink

Offline

 

#4 2008-02-01 09:39:57

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: please help

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


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer