How do I Send a Enemy away from player when hit!

0 favourites
  • 10 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • Pretty simple, I have searched the forums but can't seem to find the answer, I know this will be simple as but I just cannot get it correct.

    When player A shoots enemy, enemy goes backward away from player A no matter which way the enemy is facing or the player's mirrored or not mirrored.


    I can get the enemy to go backward if player A is facing right, but as soon as the enemy starts to walk away from player A, I get nothing.

    P.S This is for a Platform game style.

  • Hi, we can't see what you're doing wrong without a capx or screenshot

  • That's because I don't know where to start.

    If "Bullet" is on collision with "enemy" set enemy Platform vector x -4000" or if "bullet is mirrored send enemy in other direction. ( but this doesnt work if the "enemy" is mirrored )

    I know there is a way to set it so the enemy always goes backward from the players position. So when "bullet" hits "enemy" get the players current x,y,z and send backwards from the player so wherever and which ever direction the player is facing the bullet will always send the enemy backwards in the opposite direction from the player.

  • Bump! If anyone could help me out here would be much appreciated.

  • Compare the x-position of the bullet with the x-position of the enemy on collision..

    Should work..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • How would I do that exactly, sorry very novice.

  • bullet on collision with enemy

    system compare: bullet.x>enemy.x

    • enemy move left
  • This wont work, if the enemy is mirrored and is shot in the back it moves towards the player not away!

  • All I want to do is When bullet hits enemy no matter what way Im facing or the enemy is facing to send the enemy 4000 pixels away from the players current x.

  • You would use the action "Move at Angle".

    Bullet ---> On collision with Enemy / Enemy ---> Move 4000 pixels at angle angle(player.X, player.Y, enemy.X, enemy.Y)

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