Why have a separate sprite for animations?

Get help using Construct 2

Post » Wed Sep 09, 2015 1:44 pm

I have a simple multiplayer 1 v 1 fighter game set up. At the moment i have the actual Player controlled object playing the animations.

I've tried creating another object to set the animations, and set its position to the player object every tick. It seems to create a slight de-sync in position, causing unnecessary movement delay.

what are the benefits of doing it this way? i don't really understand.

Thanks
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Wed Sep 09, 2015 3:42 pm

The box helps with collision, and in some engines keeps the sprite from getting stuck on things. In some engines I've seen sprites stick to walls without a sprite box. All you have to do is create a box the same dimensions as the sprite image cell. Every tick stick your sprite to the sprite box. Then you set your controls to move the sprite box. You set the animations playing in the sprite to what ever you're doing to the sprite box. So if you have right arrow key pressed you're moving the sprite box, but the player goes with it. You also have an event set sprite to animation "walk right" while key pressed right arrow.

I need to do some more research on this myself. To be honest, I'm not sure if you need on in Construct or not. I'm kind of eager to see what other people say.
B
7
S
2
Posts: 92
Reputation: 663

Post » Wed Sep 09, 2015 3:54 pm

I've just tested and it seems to work fine. Platform controls on bounding box, every tick set sprite to bounding box. Set all your collisions to your sprite, and make sure that your sprites collision max is fitted pretty good to the sprite..
B
7
S
2
Posts: 92
Reputation: 663

Post » Wed Sep 09, 2015 9:15 pm

Thanks for the reply. I guess it is mainly to do with the collisions, some weird things can happen, falling through the floor etc.

Anyone else know if there are other benefits or reasons?

If i use the same shape / size collision box for all animations, will this make a difference?
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Wed Sep 09, 2015 9:15 pm

Thanks for the reply. I guess it is mainly to do with the collisions, some weird things can happen, falling through the floor etc.

Anyone else know if there are other benefits or reasons?

If i use the same shape / size collision box for all animations, will this make a difference?
B
9
S
3
Posts: 104
Reputation: 1,033

Post » Wed Sep 09, 2015 9:34 pm

I tend to use this approach. It helps keep the collision area constant and easier to manage because you deal with one frame whereas if you relied on the collision poly of the animations, there is more chance you might set them wrong if you have many animations/frames, and you might also want to adjust various things about the sprite like widht/height rotation/angle, etc.. Those affect the collision poly and you may want to change them without affecting the collision box so a separate sprite for it is a way to keep things more manageable.
As for there being any delay with positioning to the collision box, you would need to position the sprite to the box after any box movement/positioning is done. If you position the sprite before any movement to the box is made, then there will be a noticeable delay.
B
47
S
22
G
65
Posts: 1,127
Reputation: 38,395


Return to How do I....?

Who is online

Users browsing this forum: koops and 5 guests