0 Favourites

Multiple animations per object

  • I've been putting a lot of animations on 1 sprite and using "create object > set animation to: ".

    I'm wondering, when it does this, is it technically loading every animation when the sprite is created? Should I be using separate sprites for each animation for something like this?

  • I am fairly certain that all a sprite's animations are loaded when it is created. If you have multiple instances of the same sprite, though, it does not load the animations for it multiple times since the animations are already loaded from the very first instance.

    I've seen many people recommend using one sprite for objects that behave the same. So I think you are following good procedure.

  • aerirprown - Right, but what I'm basically doing is when an enemy dies, I spawn a "death" sprite and destroy the enemy immediately. Once I have more enemies in game, this sprite can become quite large with tons of animations that might only be used a couple times per layout.

    So I'm betting it's probably smarter to not do it this way?

  • Animations are just references to sprites on a sprite sheet, so depending on where that image is, it is "loading" a certain subset of images.

    Lets say you have 10 animations with 20 frames a piece, that is going to be broken up into a couple of sprite sheets.

    Are you worried about memory or performance?

  • firebelly - I'm worried about both. If I have 40 enemies and each of them have a 10 frame animation that I put into 1 sprite, it would affect the memory and performance if I'm loading that for only 1 animation at a time and then destroying it, no?

  • I had a large animation(large in pixels not frames) that made my game stutter for a second when it was created. So I just spawned it on the start of the layout and toggled between visible/invisible and placed it in the correct place.

    That way you could avoid constantly creating and destroying the animation.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • aerirprown - I suppose that makes sense. Thanks!

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