I'm having a problem with the 8 direction

0 favourites
  • 2 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • Hello! I have a problem I was wondering if it was familiar to somebody.

    I have a top-down project with 8 direction movement. The player has a shield and he moves with the 8-direction behavior. The enemy has an 8-direction behavior to make a knockback and some physics to avoid overlapping when pathfinding.

    When the player wants, he can press a button to get the shield up. This is just a sprite pined to the player on top of it that turns visible on press. This shield is just a sprite with no behavior

    When the enemy overlaps the shield, he is knocked out of it with some 8-direction values.

    Now, the problem. AT SOME POINT when the player has the shield, is moving, and overlaps the enemy, the player starts moving by itself in the direction it was already moving. Like if the movement key was being pressed. If I press a key in the opposite direction, the player stops moving, but when I release the key, it keeps moving in the same direction. Pressing the key makes it as if you start applying a force in the opposite direction of the current movement. Now, If I press the key in the direction the player is moving by himself, the movement stops. When I check the debug mode, it seems like the x and y vector are moving by themself, and pressing the key in the direction that the player is moving reset the values of those vectors to 0

    Is this problem familiar to anybody? Any idea what could be happening?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ...and some physics to avoid overlapping...he is knocked out of it with some 8-direction values...the player starts moving by itself in the direction it was already moving. Like if the movement key was being pressed...seems like the x and y vector are moving by themself

    It probably has to do with how you set this up - I condensed your post in the quote above to highlight - and without knowing how you set this up, not sure what advice we can give.

    Are you using 8-direction for the "knockback effect"? If so, you probably simulate movement. I'd look at how that is setup to make sure it doesn't keep simulating.

    Are you using a different movement behavior for this? I'm not sure using two movement behaviors at the same time is recommended, as I'd assume it could result in unexpected/unpredictable behavior. I'd recommend only having one enabled at a time (can switch between them by enabling one and disabling the other).

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