# How do I isometric help/movement

Get help using Construct 2

### » Tue Sep 23, 2014 11:34 pm

I am making a game with a friend and we need some simple movement down and I am puzzleed on how it would work I have the idea of the movement written
if mouse click is -y of player then change players orientation/sprite to down
Down = -y
if mouse click is +y of player then change players orientation/sprite to up
Up = +y
if mouse click is -x of player then change players orientation/sprite to left
Left = -x
if mouse click is +x of player then change players orientation/sprite to right
Right = +x

the capx has the sprites and diffrent angles and everything in it but I dont know how to change the sprite depending on where the mouse click is
MyRPG.capx
You do not have the required permissions to view the files attached to this post.
B
14
S
1
G
1
Posts: 35
Reputation: 1,090

### » Wed Sep 24, 2014 1:13 am

@ZS17 I think there are some tutorials on isometric movement on the forum here.
Also, check out @rainbowrex s plugin's / behaviors -- I think he has a solution here too
B
77
S
14
G
1
Posts: 152
Reputation: 5,126

### » Wed Sep 24, 2014 1:46 am

You need to check the angle between your object and the mouse click. Here is an example of 4 directional movement:

On mouse left click (Trigger)

Next you need the four directions, Since the angle is calculated from 0 to 180 degree when going clockwise and 0 to -180 degree when going counter clockwise you have to add 360 to those in the counter clockwise direction to get the correct angle.

So you will need 4 sub events, one for each direction and these you check with a between values.

Up (Since this is going counter clockwise we add 360)
Condition:

255 <= 360 + angle(Object.x, Object.Y, Mouse.X, Mouse.Y) <= 315

Action:
Object.Angle = 270 (So whenever you click above the object in a cone shape it will set the angle of the object to 270)

Down (Since this is clockwise we don't need to add anything)
Condition:

45 <= angle(Object.x, Object.Y, Mouse.X, Mouse.Y) <= 134

Action:
Object.Angle = 90 (So whenever you click below the object it points down)

Left (As it changes from positive to negative as it goes pass 180 you need two conditions and an OR)
Condition:
180 <= 360 + angle(Object.x, Object.Y, Mouse.X, Mouse.Y) <= 224
OR
135 <= angle(Object.x, Object.Y, Mouse.X, Mouse.Y) <= 180

Action:
Object.Angle = 180

Right (Exactly the same as for left except now it changes as it goes pass 0)
Condition:
0 <= angle(Object.x, Object.Y, Mouse.X, Mouse.Y) <= 44
OR
315 <= 360 + angle(Object.x, Object.Y, Mouse.X, Mouse.Y) <= 360

Action:
Object.Angle = 0
B
45
S
12
G
3
Posts: 1,209
Reputation: 7,537