Sprite Animation switch on mouse Location

Get help using Construct 2

Post » Mon Jun 18, 2012 6:04 am

Sorry if this is re-post I looked before posting this but couldn't find anything.

I have a Sprite that is the "Player" (Front) and I have a Right, Left, and Behind Frame for when he is looking in a particular direction.

I have no idea on how to go about doing this I basically want my "Player" to display the "Behind" Frame for when my mouse is above him and display the "Right" Frame for when my mouse is to the Right of him and so forth for the "Left" and "Front" Frames.

Sorry if I'm not clear enough, I read the rules I know this is not suppose to be a make my game for me deal I want to know how this would be made for future reference and if I'm not Clear enough I will try to be more clear if no one understands.
B
17
S
4
Posts: 96
Reputation: 1,435

Post » Mon Jun 18, 2012 9:24 am

you can try to use system expression to calculate the angle between mouse and player, if it is between 45 to -45, then right, if between 45 to 135, then up and so on
B
25
S
5
G
1
Posts: 46
Reputation: 3,347

Post » Mon Jun 18, 2012 2:12 pm

An easy way to get the angle is to use a sprite to draw a line from the player to the mouse position. Then check the angle of that sprite like yuquanzhou007 suggested.

Here is a quick example: MouseAngle.capx

PS: The MouseAngle sprite is supposed to be invisible, but I left it visible to illustrate how it works.
B
27
S
8
G
8
Posts: 903
Reputation: 8,452


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 19 guests