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

#1 2013-01-23 13:47:22

lavaghost123
New Scratcher
Registered: 2013-01-13
Posts: 4

Wall Jumping?

Whats the easiest way to add a script for wall jumping into a half-complete platformer?

Thx. LavaGhost123. :-P

Offline

 

#2 2013-01-23 18:55:28

mrn0body
Scratcher
Registered: 2012-12-11
Posts: 37

Re: Wall Jumping?

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.


Why Fit In When You Were Born To Stand Out

Offline

 

#3 2013-01-23 20:48:09

Kileymeister
Scratcher
Registered: 2008-04-17
Posts: 1000+

Re: Wall Jumping?

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.

http://i48.tinypic.com/s2xjew.gif
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)
end
NOTE:  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.

SECONDARY NOTE:  The "touching wall with your right/left side" bits are unclear, but those are their because I do not know the method you are using to sense walls.

Last edited by Kileymeister (2013-01-23 21:04:23)


I'm back, and showcasing two new* projects!  Click left or right on the image below to see!
http://img109.imageshack.us/img109/7905/part1l.pnghttp://img859.imageshack.us/img859/6417/part2bf.png

Offline

 

#4 2013-01-24 07:37:05

lavaghost123
New Scratcher
Registered: 2013-01-13
Posts: 4

Re: Wall Jumping?

Thx helped a lot  smile

Offline

 

Board footer