Jumping issue...
FanStudioUK
Member Posts: 459
Hi guys,
Which is the best method to make and actor Jump and avoid a double jump (player is allowed to jump only after he touched the ground) ?
Thank you
Which is the best method to make and actor Jump and avoid a double jump (player is allowed to jump only after he touched the ground) ?
Thank you
Comments
Timer after .1sec
Jump
Did anyone used another method?
Rule if touch pressed change jump to 1 otherwise jump =0
rule if jump =1 timer after .1 jump routine
Twitter:rondorocket
Web: rondorocket.com
I really don't like jstrahan's method ... even if it's .1 seconds I can still feel this delay and it's annoying...
Is there any other method?
What about constraining the Linear.Velocity.Y to a variable, this way we can detect when the player is in the air so he won't be able to make a jump while in the air.
I tried this method but it's kinda buggy and I don't understand why.
I have also put a display text on the actor to see his Linear.Velocity.Y and I did see something strange: when he's on the ground the value is constantly changing from -0 to 0.... why ?
You just need to constrain the Linear.Velocity.Y to an integer value, so when the player is not in the air this value will be equal to 0.
This way I've added another rule:
IF jump.button is pressed
IF Linear.Velocity.Y = 0
Player can jump
Hooray!
All
rule - when overlapping with actor of type ground AND
rule- when spacebar is down
Timer 1 second
Accel at 90 to scene
speed 300.
BUT...
you will find that GS does not consistently detect that you are on the ground so 10% or so of the time you will not be able to jump at all. To me this is unacceptable.
Here's my workaround:
Create a boolean attribute self.OnTheGround
Rule in jumper
When collides with ground
change self.OnTheGround to true (1)
New rule
When self.OnTheGround is true
-----Rule when spacebar is pressed
-------Timer - 1second - Accelerate 90 to scene
-------Change self.OnTheGround to False (0)
This is not perfect. You can roll off the edge of a cliff, fall for a bit, and then jump, but it is the best solution that I have tried (I've been trying for over a year!)
Good luck!
"Jumping Rule"
when actor receives event spacebar down & self.OnTheGround = true
-self.linearvelocity.y = 500
"Rule that enables jumping when on the ground and disables it in the air"
when actor is colliding with actor of type Ground
-self.OnTheGround = true
OTHERWISE
-self.onTheGround = false
This is what I did for my double jumping example, although it still allows 1 jump if you fall off of a cliff:
http://gamesalad.com/game/play/80376
Well if you figure out what it did I'd love to hear it. I use the method i described above and haven't found any bugs, but knowing games I know nothing is 100% bug-proof on a first attempt x]
On the instructions screen u had 3 options ( object, scoring,controls) with a back button at the bottom
When u click on 1 of the options say object it just changed the image of the three options to the games object then when u would click back instead of going back the the three options it would double click and go to the menu so a timer would give enough pause so it wouldn't double click
Well maybe to much beer