How do I make a sprite change directions on mouse angle?

Get help using Construct 2

Post » Tue Jun 27, 2017 2:18 am

The title is messy. I dont know what to call it. But anyway how would I go about making a game with isometric sprites change facing direction depending on the mouse location. Similar to using rotate towards angle. But when its rotating, it will change sprites.
B
22
S
6
Posts: 26
Reputation: 1,354

Post » Tue Jun 27, 2017 3:06 am

Hi,

You mean something simple like SYSTEM Every Tick
>> Player Set angle towards Mouse X Mouse Y?
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.

My games & gaming portal = DolyGames

If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.

Cheers,

COSMOS
B
20
S
9
G
1
Posts: 75
Reputation: 2,152

Post » Tue Jun 27, 2017 4:32 am

DolyGamesCosmos wrote:Hi,

You mean something simple like SYSTEM Every Tick
>> Player Set angle towards Mouse X Mouse Y?

Similar, What i mean its when the mouse rotates around the sprite the sprite will change its animation direction. Something similar to the Alien Shooter Series.

Actually a better comparison would be this https://www.youtube.com/watch?v=AB3_sCG1iFM The way the sprite animation changes based on the movement. Except I just want the effect but not for movement. I just want the effect for mouse look.
B
22
S
6
Posts: 26
Reputation: 1,354

Post » Tue Jun 27, 2017 4:20 pm

Ok, I understand better what you want.

So you need to explain to the computer which animation to play for every possibility of movement. There are always many ways, but in my projects, and I am not some super expert, I am using angles to do that.

To do this you need to picture in front of you the angles: 0 is on the right side, -90 is up and 90 is down and so on.

So you need to setup several events to cover each range and you say:

If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 0 and -30
If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 0 and +30
go right
and set animation to "right"

If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 30 and 70
go top right
and set animation to "top right"

If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 70 and 110
go up
and set animation to "up"

etc

it will also help you to put a temporary text showing current angle on the screen so you can solve bugs around angle 0

good luck
Thank you to Construct 2 for giving me the ability to create games without programming knowledge.

My games & gaming portal = DolyGames

If anyone wants to cooperate to help each other Win-Win please email me - I am always happy to discover new opportunities.

Cheers,

COSMOS
B
20
S
9
G
1
Posts: 75
Reputation: 2,152

Post » Wed Jun 28, 2017 3:10 am

DolyGamesCosmos wrote:Ok, I understand better what you want.

So you need to explain to the computer which animation to play for every possibility of movement. There are always many ways, but in my projects, and I am not some super expert, I am using angles to do that.

To do this you need to picture in front of you the angles: 0 is on the right side, -90 is up and 90 is down and so on.

So you need to setup several events to cover each range and you say:

If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 0 and -30
If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 0 and +30
go right
and set animation to "right"

If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 30 and 70
go top right
and set animation to "top right"

If the angle(Player.X,Player.Y,Mouse.X,Mouse,Y) is between 70 and 110
go up
and set animation to "up"

etc

it will also help you to put a temporary text showing current angle on the screen so you can solve bugs around angle 0

good luck

Alright, I'll try it.
B
22
S
6
Posts: 26
Reputation: 1,354


Return to How do I....?

Who is online

Users browsing this forum: megatronx, RetrocadeMedia and 1 guest