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

#1 2011-02-11 15:22:13

deliciabale
New Scratcher
Registered: 2011-02-11
Posts: 1

Can any one help with my platform game?

here is the link to the project -  http://scratch.mit.edu/projects/deliciabale/1590637

I don't know how to make it move so it will only be on platforms and fall if it is anywhere else. Also how do you have a sprite that will make the main one lose a life.

Offline

 

#2 2011-02-12 22:22:24

wrongtriangle180
New Scratcher
Registered: 2010-10-21
Posts: 11

Re: Can any one help with my platform game?

I see why you're having problems, since you only signed up yesterday. Here is the script you should use. You'll need 2 variables: jump and yvelocity.

[blocks]<when green flag clicked>
<set{ jump }to( 0
<forever>
<if><< <key[ up arrow ]pressed?> <and> <( <{ jump }> <=> 0 )> >>
<repeat( 30
<set{ jump }to( 1
<change y by( 2
<end>
<set{ jump }to( 0
<set{ yvelocity }to( 0
<repeat until><touching color[ brown
<change{ yvelocity }by( -0.2
<change y by( <{ yvelocity }>
<end>
<end>

And for the lose a life problem, create a variable called lives:
<when green flag clicked>
<set{ lives }to( 5
<forever>
<if><< <touching color[ blue <or> <touching[ spider >>
<if><( <{ lives }> <>> 0 )>
<change{ lives }by( -1
<go to x sad  starting x )y sad  starting y
<else>
<stop all>
<end>

This script also helps with game overs, and it doesn't have to be another sprite's script. I, myself, am also making a platformer, so I actually have these scripts with me. I'm glad to be of assistance!  wink

Offline

 

Board footer