Jumping

VmlwebVmlweb Member Posts: 427
edited November -1 in Working with GS (Mac)
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

Comments

  • scitunesscitunes Member, Sous Chef Posts: 4,047
    SHOULD be able to say when up is pressed AND actor is touching ground

    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.
  • rebumprebump Member Posts: 1,058
    I'm have the same experience as scitunes when it some to jumping. Have some okay jumping but not what I want.

    Let us know if you get anything near Mario-ish!? :-)
  • VmlwebVmlweb Member Posts: 427
    scitunes
    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.
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    the change attribute for jump.game should be placed after the accelerate up with a timer. This has always worked for me no problem. When I get a moment I will create a demo project .
  • VmlwebVmlweb Member Posts: 427
    I have

    If up and jump are true
    Timer For 1 second { accelerate up relative to scene}
    change jump to false
  • autofireautofire Member Posts: 5
    seems like jumping is causing lot of frustration for many of us. I have a game where you control a ball that bounces constantly (jumps automtaically like Doodle Jump), but once in a while the ball will randomly jump higher or lower than usual. Sometimes the ball just stops jumping after a while. ? 95% of the time the jumps are as intended, only 5% they are off. Why

    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
Sign In or Register to comment.