Jumping
Vmlweb
Member Posts: 427
Hey,
I'm having an unbelievable amount of problems with a simple jump in one of my platform games.
Here is the layout.
http://gallery.me.com/victor96/100192/Initial Scene/web.png?ver=12618130570001
I've done the bits to make the mans velocity increase when left and right are pressed.
I've also done all the animations, the problem now is I've tried so many ways and they're all unbelievably buggy and glitchy that i just started over.
Anyone know the best way to make the guy jump when the up arrow is pressed?
Thanks,
Victor
I'm having an unbelievable amount of problems with a simple jump in one of my platform games.
Here is the layout.
http://gallery.me.com/victor96/100192/Initial Scene/web.png?ver=12618130570001
I've done the bits to make the mans velocity increase when left and right are pressed.
I've also done all the animations, the problem now is I've tried so many ways and they're all unbelievably buggy and glitchy that i just started over.
Anyone know the best way to make the guy jump when the up arrow is pressed?
Thanks,
Victor
Comments
accelerate up
HOWEVER - GS has a ways to go when it comes to collision detection (IMO) so this will not work consistently even though in theory it should (I've spent many hours working through this).
Here's my fix:
Create a boolean game attribute (we'll call it "jump")
In your player actor make a rule that says:
rule
when actor collides/overlaps with ground (or whatever you have named the platform actor)
change attribute game.jump to true(1)
rule (ALL)
when game.jump is true
when up arrow is down
accelerate up (Use a timer to and max speed settings to control how high and fast it jumps)
change attribute game.jump to false(0)
Here's what it does. GS seems to detect when your player is touching the ground about 70% of time so this method only requires one collision detection between jumps instead of constantly detecting collision. So when you touch the ground game.jump is set to true which means that you can now jump. The instant you hit the jump button game.jump is set to false which means you cannot jump again until you land on the ground again (landing will set game.jump to true). So this lets you jump every time the up arrow is pressed but will not let you keep tapping the up arrow making the actor appear to be flying.
Hope this helps.
Let us know if you get anything near Mario-ish!? :-)
I used your method and the problem is the man isn't jumping.
As soon as I press the up button Jump turns to false and nothing happens.
If up and jump are true
Timer For 1 second { accelerate up relative to scene}
change jump to false
I based my jump on the jump in the platform tutorial in GS, but just removed the condition for the up key to be pressed so it jumps automatically.
Rule: when attribute self on the ground is true
Timer: for 0.14 seconds, run to completion
Accelerate: 3000, direction 90, relative to actor
change attribute to self on the ground to: false