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

#1 2008-04-13 13:12:19

thomas10soa
Scratcher
Registered: 2008-03-18
Posts: 5

GRAVITY

i need help in setting up gravity in my game,

i have jumping and moving perfect but what i want to do is be able to jump onto platforms

can someone tell me how to do this

i made it so my character could jump on a platform but now he cant get back down becouse theres no gravity pulling him down to ground level

please help somebody

Offline

 

#2 2008-04-13 13:17:57

thecooltodd
Scratcher
Registered: 2008-03-08
Posts: 75

Re: GRAVITY

<when green flag clicked>
<forever>
<if><<  <not>  <touching[ Ground ] >>
<change{ Y velocity }by( -1
<change y by( Y Velocity
<else>
<set{ Y velocity }to( 0
<end>

That makes your sprite accelerate to the ground at 1 pixel per frame squared.  If you just need generic gravity that pulls them down without acceleration use this:

<when green flag clicked>
<forever if> <not>  <touching[ Ground ] >>
<change y by( -1
<end>

You also don't have to use -1 for either of them, use a higher number and they'll fall faster.

Last edited by thecooltodd (2008-04-13 13:22:21)

Offline

 

#3 2008-04-13 14:02:29

thomas10soa
Scratcher
Registered: 2008-03-18
Posts: 5

Re: GRAVITY

cheers mate worked perfectly ur great

Offline

 

#4 2008-04-14 00:39:24

thecooltodd
Scratcher
Registered: 2008-03-08
Posts: 75

Re: GRAVITY

Glad I could help. ;D

Offline

 

Board footer