Move Player Up a Few Pixels On Button Press

0 favourites
  • 7 posts
From the Asset Store
Vintage steam pixels for your UI! 125 unique assets in a single pack!
  • Right now I have my game set up to use the platform behavior until the F key is pressed and it toggles to 8-way movement. Its suppossed to give the effect of going from running to flying.

    My problem is that sometimes when I switch to the "flying/8-way mode" the player will slide a bit to the left or right like they are snapping to a grid before moving normally. I figure I could live with making the player slide upward a few pixels to give it the look of pushing up a little bit when switching to flying.

    I imagine I would need to find the current location of the player when the F key is pressed and then tell it to move upwards a few pixels. I'm not sure how to do that or if it is the best solution.

    I'm kind of a noob so any help is appreciated.

    You can go here to see the sliding that its doing: Superhero Test

  • Care to post your capx file?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sure, but I'll have to do it when I get home from work. Thanks.

  • On F key pressed -> set Player.Y to Player.Y-3

    Player.Y being whatever the players sprite is called.

  • I believe when you disable the behavior it remembers the speed so when you enable it again it will carry on moving in the direction it was going when you disabled it. Try setting the platform vector x and y to 0 when you disable the platform behavior and use the 8-direction stop action when you disable 8-direction.

  • ramones, that actually sounds like what the problem might be. He tends to slide based on the direction I was holding when I last hit the button. I will try and implement it this weekend.

    Here is the Capx in case anyone wanted to see its current state.

    Superhero Test


  • On F key pressed -> set Player.Y to Player.Y-3

    Player.Y being whatever the players sprite is called.

    EncryptedCow, That works great, but I just need it to move him up for half a second and then stop subtracting from Y. I tried setting up a "Wait" event within the same toggle, but Construct wouldn't let me add an event after it. Sorry if this is a noob problem.

    ramones, that seems to be exactly what was happening. Thanks!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)