Animated Sprites

(Jacob Albano) #21

Well, this is confusing.

@johnBen Are you also overriding update() in your World and forgetting to call super.update()? Is your Spritemap’s active property set to false? I can’t think of a reason for you to have to update your graphics manually – and the fact that you do means you probably have other problems that will manifest later.

(Martí Angelats i Ribera) #22

Why is it confusing? entity.update() is empty but is created to allow the world.update() call it. So nothing happens when you use super.update() inside the overrided update function.

(Jacob Albano) #23

I’m confused because I had thought the graphics were being updated in the base class’ update() function. Failing to call to super would explain the behavior.

(Martí Angelats i Ribera) #24

It’s actualy updates in the world.update() function… a bit wierd actually.

(Zachary Lewis) #25

World updates any tweens, entities and graphics inside it.

Starting with the first Entity, World.update() does the following:

  1. If it has any tweens, update them.
  2. Call the its update().
  3. If it has any graphics and they are active, update them.
  4. Get the next Entity.

Remember, Entity is designed as a convenience class to allow the user to manipulate a typed group of hitboxes and graphics without having to roll their own.