How do I chnage sprite for an 8 angle movement?

Get help using Construct 2

Post » Wed Dec 28, 2016 3:02 am

I have 8 sprites which have different degrees of rotation. I want to be able to set it up so when the object moves it will change the sprite. So if I tell it to move top right it will show the 45 degree sprite and so on. For an example I want the moveable object to act like units in Red Alert or simular RTS games.

Forgive me, I have only just started using the program and have also looked through examples but can't figure it out.
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Wed Dec 28, 2016 3:13 am

Put your graphics all in one sprite with each graphic having a different frame and named animation.

Then you can use set animation in the events.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Wed Dec 28, 2016 3:16 am

set animation frame to abs(self.8waymovement.angleofmovement/45)? does that work?

and the speed of movement or rotation needs to be set to 45 degrees interval or 360 degrees rotation, never 90 degrees interval unless you divide the angle by 90 and show only 4 frames. cause 360/45 = 8 , and you need the rotation to happen on 360 degrees to show all the frames.
B
77
S
23
G
69
Posts: 1,353
Reputation: 43,958

Post » Thu Dec 29, 2016 12:34 am

Thanks guys. I tried most of what you said, but I kind of stumbled upon the fact that if I set the frame to the angle the sprite is facing and then stop all animations in events and then set the frame to the one matching the sprite in the layer, the 8 direction behavior takes over and it works like a charm. I can't believe how well this engine works, it truly does help the non programmer make games. I can upload an example file if anyone wants to check it out for what I wanted?
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Thu Dec 29, 2016 5:16 pm

I was mistaken and what I said is not the fact. It just looked like it because I overlooked the fact my sprite is a top down view.

abs(self.8waymovement.angleofmovement/45) just gives me errors and wont let me click done.

I have added my sprite and given it the frames, but I have no idea as of yet how to make the animations. I can only add new frames to the sprite.
B
13
S
7
G
2
Posts: 65
Reputation: 2,307

Post » Thu Dec 29, 2016 6:51 pm

SpyDaniel wrote:I was mistaken and what I said is not the fact. It just looked like it because I overlooked the fact my sprite is a top down view.

abs(self.8waymovement.angleofmovement/45) just gives me errors and wont let me click done.

I have added my sprite and given it the frames, but I have no idea as of yet how to make the animations. I can only add new frames to the sprite.



In the editor you create your sprite. In the add frames box you can duplicate frames in the animations frames box. Right click to add blank frames, copy or duplicate. In the Animations box you see little rolls of film and you need to name those.

Click on one of your named film strips and the properties box will open and you can set the speed of the animations and set it to loop or not.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Thu Dec 29, 2016 9:29 pm

Ok, so I have the animations named (for now they are just single frames of different angles) and I have set up events and actions in which I think should work, but I am not getting the results I wanted. I'm not quite sure if what I have it right etc.

Image
B
13
S
7
G
2
Posts: 65
Reputation: 2,307


Return to How do I....?

Who is online

Users browsing this forum: Artcadev and 12 guests