8 directions speed always move to the right by default?

0 favourites
  • 4 posts
From the Asset Store
This Girls Game allows young fashionistas to develop their taste and skills as a fashion designer.
  • Hello comunity!

    I'm doing a small action here for my top-down rpg. I want the player to move slightly in the direction he is attacking, so I made this:

    What I'm finding out is that whenever I set the 8-movement speed, the player always moves to the right by default. In this case, the player instead of just moving left he moves to the right really fast and then he moves to the left as intended.

    Is there anything I'm not understanding with the 8-direction movement?

    I know I probably could do the same with bullet behavior in the angle of the mouse, but I was confused by this.

    Thanks for being interested!

    Tagged:

  • An addition to this, I see that if I play with the x vector function on the event, they don't move at the same speed for right as for left! Just a bit more information.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When the speed is 0 then yes the default moment angle is to the right. This happens because internally the behavior stores the x and y velocity separately and calculates the angle of motion from that. Angle(0,0,vx,vy)=0 when vx=0 and vy=0.

    Anyways an often used solution is to set the angle of motion directly after setting the speed.

    As to your other issue, setting the speed would be different than simulating a key press. When simulating a key the acceleration, deceleration and existing velocity are in the mix. So it would make sense that it would almost always be slower than setting the speed directly.

  • I see! Thanks! I'm not sure how to make it work as I want, but I feel like I understand a bit more now and I will keep trying.

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