Jumping issue...

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

Comments

  • jstrahanjstrahan Member Posts: 498
    Put a delay of .1 in ur jump control this should stop the double jump u came do less time but to low won't stop thee double jump
  • FanStudioUKFanStudioUK Member Posts: 459
    Could you be more specific please?
  • jstrahanjstrahan Member Posts: 498
    When touch
    Timer after .1sec
    Jump
  • jstrahanjstrahan Member Posts: 498
    I had a simmer problem with a back button if u were more than 2 levels deep it would go back 2 levels
  • FanStudioUKFanStudioUK Member Posts: 459
    No, it's not working like I want.... thanks anyway.

    Did anyone used another method?
  • jstrahanjstrahan Member Posts: 498
    Try this make attribute jump integer 0
    Rule if touch pressed change jump to 1 otherwise jump =0
    rule if jump =1 timer after .1 jump routine
  • RondoRocketRondoRocket Member Posts: 411
    You have to include in your rule that the actor "overlaps or collides" with your ground actor in order to jump.
  • FanStudioUKFanStudioUK Member Posts: 459
    I followed the Simple Jump method.

    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 ?
  • FanStudioUKFanStudioUK Member Posts: 459
    Gave it another try and it seems to work!

    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! :)
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    This has always been a problem with GS. You SHOULD be able to have a rule like this

    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!
  • FanStudioUKFanStudioUK Member Posts: 459
    Thank you scitunes, the method with the Linear.Velocity.Y it's working good, so I'll stick with that for now :D
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I'll have to try that. Just keep in mind that this will not work if you are going up or down a hill or are on a moving platform that moves up and down.
  • FanStudioUKFanStudioUK Member Posts: 459
    Yes you are right, but I dont have hills or moving platforms in my game :)
  • ToastKittenToastKitten Member Posts: 360
    @SciTunes, couldn't you do something like this to prevent the actor from jumping when it falls of the cliff

    "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
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I tried that and it worked most of the time, but seemed to cause other problems (I can't remember what exactly but I remember that it forced me to try a different route).
  • ToastKittenToastKitten Member Posts: 360
    Sad face :(

    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]
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    If I remember right I think it made it so the timer didn't seem to shut off so my character would rocket off the screen instead of only accelerating for a brief moment. When I got rid of the otherwise part of it and used the method I described above it never happened so for now I have stuck with it.
  • jstrahanjstrahan Member Posts: 498
    yea figured it may slow it down but figured it was worth a try sorry hadnt needed jump yet
  • ToastKittenToastKitten Member Posts: 360
    Wait... why are you using a timer again?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    so it only accelerates up for a short amount of time
  • jstrahanjstrahan Member Posts: 498
    My issue was on the menu u would click on instructions
    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
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    are we still talking about jumping?
  • jstrahanjstrahan Member Posts: 498
    No switched to beer and football
    Well maybe to much beer
Sign In or Register to comment.