This should do it (assuming you're not using animations)
when gf clicked forever if<key [right arrow v] pressed?> change [x-vel v] by (0.2) end if<key [left arrow v] pressed?> change [x-vel v] by (-0.2) end change x by (x-vel) if<touching [wall/floor v]?> set [x-vel v] to ((-0.5)*(x-vel)) change x by (x-vel) if<touching [wall/floor v]?> change x by (x-vel) end if<<key [up arrow v] pressed?> and <(y-vel) < (0)>> set [y-vel v] to (3) if<(x-vel) > (0)> set [x-vel v] to (2) else set [x-vel v] to (-2) end end end change [y-vel v] by (-0.2) change y by (y-vel) if<touching [wall/floor v]?> set [x-vel v] to ((0.96)*(x-vel)) set [y-vel v] to ((-0.5)*(y-vel)) change y by (y-vel) if<touching [wall/floor v]?> change y by (y-vel) end if<<key [up arrow v] pressed?> and <(y-vel) > (0)>> set [y-vel v] to (4) end else set [x-vel v] to ((x-vel)*(0.98)) end
Offline
GoldTube wrote:
Does this work with walls that are in different angles?
Not that I have walls in different angles.
It works with walls with non-90-degree angles insofar that you'll never end up inside a wall. But (and these are just the glitches that come to mind, I haven't actually tried it):
- you won't be able to walk up slopes
- when you jump on a slope it could be treated as a wall jump OR a "floor jump"
- you won't bounce correctly off of walls; they'll all be treated as 90-degree walls (you'll never end up inside, but your motion won't be accurate.
Summary: if you want to, you can use it for non-90 degree walls, but the result will likely be less than satisfactory. If you're interested, this project allows you to use sloped floors and uses a script that functions on essentially the same principle (using the sprite itself as the sensor); bouncing still treats walls like they are 90-degrees, but at least it allows for slopes. It doesn't have wall jumping though (I could probably add it, but it would be a kind of difficult to differentiate between "slopes" and "walls").
Offline
GoldTube wrote:
If only I could download scripts from the forums...
I have a wall-jumpin engine here. You could take a look. Im pretty sure it works the same way MoreGamesNow's script does.
Offline
here is one
[scratchblocks]
when [up arrow ] pressed
change Y by (20)
wait (0.5) secs
change Y by (-20)
Offline
You can change "set [y-vel v] to (4)" to a bigger number to jump higher.
You can change "set [y-vel v] to (3)" to a bigger number to wall-jump higher.
Alternatively you can decrease the force of gravity ("change [y-vel v] by (-0.2)") which will result in both being higher.
Last edited by MoreGamesNow (2012-08-17 14:45:43)
Offline
Get rid of the second "(yvel) > (0)" conditional. I posted this on the other thread, but you must have missed it
Offline
Double oops: the real problem is that in the actual project you copied it down with a "less than" sign rather than a "greater than" sign. You're probably thoroughly annoyed with me now
Offline
Edwardscrach wrote:
here is one
when [up arrow v] key pressed change Y by (20) wait (0.5) secs change Y by (-20)
fixed-but this is jump not wall jump
Offline