Using move instead of accelerate (jump problem)

astrom0astrom0 Member Posts: 40
edited November -1 in Working with GS (Mac)
I'm making a simple platform type of game, I'm having a problem with sliding, I set the friction and drag, and it works ok but I want to avoid any sliding at all. I tried using move and it worked great but when my actor jumps and moves at the same time he flys in the direction Im pressing, I want to use the move behavior because it eliminates sliding and moves quickly instead of taking its time. Basically is there any way to use the move function and jump with out sliding through the air?

Comments

  • mangaroomangaroo Member Posts: 419
    if you mean drifting/sliding in the air then try constraining linear x motion to 0 while linear y motion is not equal to 0

    that's slightly more processor intensive then it needs to be but without knowing why he is sliding...? try firstly just changing linear x motion to 0 when he jumps...(im worried that this wont have an affect if your actor moves in the direction of the finger and player keeps his finger on screen while jumping)..in which case you can set the actor to follow only when he isnt jumping..but in any case a little more detail would be required for an alternative solution for me at least...

    i thought move cancels out all other velocities like you said?.

    OKOK i think i just realised - you have the move behavior assigned to player going right/left? but you are using something else for the jump?

    move behavior - that actually overrides other movement attributes which could be why its not cancelling when you jump. try setting the jump with a move as well or if not, try setting an extra condition for the move sideaways attribute such as: when jump/button for jump pressed is false
  • astrom0astrom0 Member Posts: 40
    let me explain more about my game, so it will make more sense. I have a main character controlled by a left button and right button, I was using accelerate to move left and right but decided to use move because it prevents sliding/drifting . I'm not using gravity but using acceleration down at 500. I set my move to 300 left and right, Max speed checked, density at 5, friction ar 15, max speed at 300

    My jump is set up like so:

    When (all) conditions are valid:
    Attribute- self.Motion.Linear Velocity.Y... => 0
    Attribute- self.Ground... is true
    Attribute- game.TriggerJump... is true

    Change Attribute: self.Motion.Linear Velocity.Y... To: 1000

    Otherwise:
    Change Attribute: game.TriggerJump... To: fasle

    Still cant get it to work properly.
  • mangaroomangaroo Member Posts: 419
    move overrides the change linear y motion - have a look at the suggestions i made, you can try putting the accelerate left/right under rules for when self.Motion.Linear Velocity.Y is equal to 0- that way they cant move once they jump & then you have to add a change linear x velocity to 0 when he jumps so that the jump cancels the accelerate left/right before it, if that doesnt work or has issues for any reason, try constraining linear x motion 0 while jumping
  • astrom0astrom0 Member Posts: 40
    I used change attribute linear motion x -250 for left and 250 for right and lowered the other objects friction to 0.1 and the jumping worked perfectly, Thanks for helping =]
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    You also wont need to check the max speed box, or set it to 300. Those are for acceleration behaviors.
Sign In or Register to comment.