Thrust player on key press [c2]

0 favourites
  • 4 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi Community,

    I'm looking for a simple solution for my platformer game.

    So far - player has [Platform behavior] with default controls DISABLED.

    I've hard-coded the left/right controls to keys but I'd like the [up] key to create THRUST motion.

    Have looked online but getting a little confused. I see some examples using CustomMovement/Platform

    Event Sheet > Keyboard = Up arrow is down = up.

    I created an instance variable on the player called Thrust with an initial value = numeric (0); the idea was, then key UP is pressed... Player.Thrust +1 and if key released, drops to 0

    It's just getting the player to do same. I may try BULLET, but I have my reservations.

    Any help would be appreciated.

    Thanks,

    Roberto

  • You referring to thrust as in physics impulse type thrust or thrust as in simple movement in a direction?

    If you are referring to simple movement then you will need to use the platform event "simulate keypress up" when up key is pressed.

    You could use bullet as well to apply simulated force by turning it off and on. My ship is CDStU uses bullet for movement and also a reverse bullet movement when released to simulate force being applied against it when forward thrust no longer applied.. I like the effect.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi chrisinfinger,

    Sorry, I should have been more clear... gravity sets player on floor, if key is pressed, then lift-off. I will experiment with Bullet in the mean time.

    Thanks,

    Roberto

  • I've semi-achieved it, but not happy with result.

    so i created a separate thrust-sprite which spawns on player when thrust >10... Then player is 'set position to thrust-sprite'

    http://robfreeman.co.uk/demo/

    Here you can see, I tap UP key and player jumps... but if I keep UP key pressed, a green sprite appears (as described above) ... it's all very messy.

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