How do I change the player sprite on click-to-move?

Get help using Construct 2

Post » Sat Jul 02, 2016 5:45 pm

How do i change the player sprite when using click to move in 4 directions?

Example: When clicking up the player sprite changes to the up animation. When clicking left or right it changes to those animations.
Click to move just changes the angle of the one sprite. How do i implement sprite change?
B
6
S
2
Posts: 10
Reputation: 524

Post » Sat Jul 02, 2016 6:21 pm

you could measure the angle between the current position and the mouse poisition

angle(player.X, player.Y, Mouse.X, Mouse.Y)

so if it's between 0 and 90, change the animation frames to right, between 90 and 180 change to down etc...
B
18
S
7
G
1
Posts: 160
Reputation: 1,934


Return to How do I....?

Who is online

Users browsing this forum: YoHoho and 17 guests