Game Development Reference
In-Depth Information
Now, inside the Keyboard Controls group, create a new rule and name it Jumping .
Change the rule to Actor receives event | key | space | is down , and we need to
check another condition, so click on the + button inside of the rule, and change the
new condition to Attribute | self.OnGround is true . This will not only check if
the space bar is down, but will also make sure that he is colliding with the ground.
Drag in a Change Attribute behavior inside of this Jumping rule, and change it to
self.OnGround to 0 , which, you guessed it, turns off the OnGround condition so the
player can't keep jumping! Now drag in a Timer behavior, change it to For | 0.1
seconds, then drag in an Accelerate behavior inside of the Timer, and change the
Direction to 90 , Acceleration to 5000 .
Again, play around with these values. If you want him to jump a little higher, or
lower, just change the timing slower or faster. If you want to slow him down a bit,
such as walking speed and falling speed (which is highly recommended), in the
Attributes section in the Actor window, under Motion change the Max Speed (I
ended up changing it to 500 ), then click on Apply Max Speed . If you put too low a
value, he will pause before he jumps because the combined speed of him walking
and jumping is over the max speed so GameSalad will throttle him down, and that
doesn't look right.
 
Search WWH ::




Custom Search