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

#1 2011-04-29 17:05:18

Miniguy256
Scratcher
Registered: 2011-03-26
Posts: 5

How to make a sprite jump with y velocity

<if>To make a sprite jump, make the variable y velocity. Then make this code.
[blocks]
<when green flag clicked>
<set{ y velocity }to( 0
<forever>
<if><touching color[ black
<set{ y velocity }to( 0
<if><key[ up arrow ]pressed?>
<set{ y velocity }to( 15
<end>
<end>
<change y by( y velocity
<change{ y velocity }by( -1
<end>

Offline

 

#2 2011-04-30 16:53:52

Miniguy256
Scratcher
Registered: 2011-03-26
Posts: 5

Re: How to make a sprite jump with y velocity

Oops, I forgot to mention the sprite has to be sitting on a black line.

Offline

 

#3 2011-06-03 19:41:49

poemon1
Scratcher
Registered: 2011-01-12
Posts: 500+

Re: How to make a sprite jump with y velocity

[BLOCKS] <When green flag clicked>
<forever>
<If<key right arrow pressed?>>
<Change[speed] by (1)>
<if<key left arrow pressed?>>
<Change [speed] by (-1)>
<Set [speed] to (speed(X)(0.9)>
<Change X by [speed]> [/BLOCKS]


http://i47.tinypic.com/rrqe13.gif

Offline

 

Board footer