Vector X isn't working as intended

0 favourites
  • 4 posts
From the Asset Store
25 high-quality cars. This asset is perfect for a side scrolling game, or even a turn based RPG type game.
  • I'm trying to knock back an enemy when it is hit by the player. I've been doing this by giving the enemy the platform behavior, and setting the vector X to Self.X+/-50. these are in two different events. If the enemy X is greater than the player X, it is +50, if it is less then the player X, it is -50. But for some reason even when the enemy X is lower than the player X, the enemy will still go to the right.

    Why is this happening, and how can I fix it so that the enemy goes away from the player?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You want to make sure you have the X-vector is lasting longer than 1 tick. It is also affected by accel and decel rate.

    I do a minor knock back to my character here and a larger one to the enemy.

    My enemy has 1500 Accel and Decel and 280 Jump Str.

  • Sorry if I seem stupid, but I don't entirely understand. I've tried implementing a few of the things you did into the events I have, but the enemy still acts as if it is adding to the vector X when I am to the right of it.

  • Nevermind, I'm dumb, I managed to make it work. Thank you so much for your help :)

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