# How do I set angle to moving direction

0 favourites
• 10 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
• hi,

i have an object wich i can drag

i want my object look at the direction i drag it

so i must get angle from moving but i dont know how !?

• ## Try Construct 3

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

Construct 3 users don't see these ads
• You can compare every tick if the X and/or Y is increasing or decreasing. For the X axis example: If it's increasing, it means its going right. If it's decreasing, it means its going left. It's the same for the axis Y.

• You can compare every tick if the X and/or Y is increasing or decreasing. For the X axis example: If it's increasing, it means its going right. If it's decreasing, it means its going left. It's the same for the axis Y.

so how i set the angle !?

• one way

https://goo.gl/CpAixD

• > You can compare every tick if the X and/or Y is increasing or decreasing. For the X axis example: If it's increasing, it means its going right. If it's decreasing, it means its going left. It's the same for the axis Y.

>

so how i set the angle !?

The way I explained you don't need the angle. But you also need to explain how is your game in order to know the best way to do it. It is a platform or Top-down?

• if your dragging ur object... or u have to touch ur finger on screen... set.angle to direction Touch.x Touch.y thats it .... or set.angle to angle(player.x,player.y,touch.x,touch.y) or ... rotate towards angle = angle(player.x,player.y,touch.x,touch.y) ... . no crazy coding needed

the player.x player.y being the object your drag

• one way

https://goo.gl/CpAixD

thanks but when you drag object slowly then its not smooth and change direction so fast, it seem crazy !

• and what's wrong with crazy ? <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

Version 2 -

https://goo.gl/zBlaR2

known problem - If you move very slowly "backwards" with constant "left/right" corrections you can reverse the arrow straight back but apart from that.... <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

• and what's wrong with crazy ? <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

Version 2 -

https://goo.gl/zBlaR2

known problem - If you move very slowly "backwards" with constant "left/right" corrections you can reverse the arrow straight back but apart from that.... <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

thanks so much its what i needed !

• 10 posts