Why have a separate sprite for animations?

0 favourites
  • 6 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • 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

  • 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.

  • 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..

  • 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?

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)