How do I make it look like the player sprite nudges object?

0 favourites
  • 3 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Im working on a top down game and wanted some sprites/objects to just sit on screen unless the player collides with it. When the collision happens, I want the sprite to move out of the way just a bit, to look like the player kind of lightly kicked it out of the way. How would I go about doing something like that? Thanks for your time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try using a bullet behavior on the sprite, default 0 speed/gravity.

    Condition: Sprite on collide with Player

    Actions: Set Sprite bullet angle of motion to angle(player.x, player.y, sprite.x, sprite.y) //Maybe +180, I forgot if this will angle towards the player or away from the player off the top of my head.

    Set Sprite bullet speed to 200 //Or whatever initial speed

    Decay bullet speed:

    Condition: Sprite bullet compare speed > 0

    Action: Set Sprite Bullet speed to floor(sprite.bullet.speed/2) //Eased out deceleration, you can use sprite.bullet.speed-20 for linear deceleration for example. Best practice might be to add max(0,x) expression to constrain the speed so it does not go below 0.

  • Brilliant! I would never have thought of that but it's exactly what I was looking for. Thank you!

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