if you had maybe 5-6 costumes you could have 3 going up and 3 coming down !you could say
<when[space ]key pressed>
<wait( 0.1 )secsc>
<switch to costume[ 1
<wait( 0.1 )secsc>
<switch to costume[ 2
<wait( 0.1 )secsc>
<switch to costume[ 3
<wait( 0.1 )secsc>
<switch to costume[ 4
<wait( 0.1)secsc>
<switch to costume[ 5
<wait( 0.1 )secsc>
<switch to costume[ 6
Last edited by dav09 (2009-07-25 09:27:42)
Offline
JoeKRox wrote:
Hmm... but if I did that, would I be able to land on platforms?
If you don't use the change Y, you can't land on platforms. At all.
Offline
make a variable called gravity
<{ gravity }>
and add this script to whatever u want to jump
<when green flag clicked>
<set{ gravity }to( 0
<forever>
<if><touching color[ colour of the ground
<set{ gravity }to( 0
<if><key[ up arrow ]pressed?>
<repeat until><< <not> <touching color[ colour of the ground >>
<set{ gravity }to( however high u want the person to jump
<change y by( <{ gravity }>
<end>
<end>
<else>
<change{ gravity }by( how high gravity you want (make sure it's a negative number)
<change y by( <{ gravity }>
<end>
<end>
Last edited by deatheater (2009-07-27 04:57:14)
Offline
You need a jumping script and a gravity script.
To jump:
<when[ Event triggered... ]key pressed>
<broadcast[ gravity ]]
<repeat until><< <touching[edge] <or> <touching color[ColourOfPlatforms] >>
||<change y by( 2 )]
<end>
Now, for the gravity script:
<when I receive[ gravity ]]
<set{ var }to( 0
<repeat until><< <touching[edge] <or> <touching color[ColourOfPlatforms] >>
||<change{ var }by( 1
||<move( (( 0 <-> var )) )steps>
<end>
This script produces a proper perabila!
You can also replace a straight-up jump with a vector: just point the sprite in the desired direction, and replace the <change y by( 2 )] block in the jump script to <move( 2 )steps>.
(You can see how the increasing var value produces the non linear decrease rate, following a sheared exponential pattern, needed for a perabila)
Enjoy!
Offline