Whats the easiest way to add a script for wall jumping into a half-complete platformer?
Thx. LavaGhost123. :-P
Offline
lavaghost123 wrote:
Whats the easiest way to add a script for wall jumping into a half-complete platformer?
Thx. LavaGhost123. :-P
Welcome to Scratch!
There is a good article on the scratch wiki about wall jumping but since you are new I wouldn't recommend it since its very complex.
Offline
If you have a basic platforming script down, all you need to do is add another if clause that senses the following:
A) You are touching a wall
B) You are not touching the ground
C) (Optional but recommended) You are falling down and not rising up
Place your jump script into this if-clause. (If you are using velocity, it's a good idea to add some x-velocity as well to push you away from the wall.) Now you can jump not only when on the ground, but when that criteria is also met.
Now that's all words and no scripts, let me add some images in a second.
If you are familiar with velocity, plug the bottom script chunk into your movement script. If not, plug the top chunk into your movement script.
EDIT: Hrm, the image shrank itself a bit. I'll convert it into scratchblocks instead if it has become a bit unclear.
if <<touching [Wall]?> and <not <touching [Ground]?>>> if <key [up arrow] pressed?> repeat (10) change y by (10) end end end
if <<touching [Wall]?> and <not <touching [Ground]?>>> if <(y velocity) < (0)> set [y velocity] to (-1) if <key [up arrow] pressed?> set [y velocity] to (0) if <touching [Wall With Your Right Side]?> set [X Velocity] to (-5) end if <touching [Wall With Your Left Side]?> set [X Velocity] to (5) endNOTE: Anywhere a number is supplied as 10, 5, or 1 (or their negative counterparts) can be changed around of course, that's just to give a general idea of how the numbers should relate.
Last edited by Kileymeister (2013-01-23 21:04:23)
Offline
Thx helped a lot
Offline