Closed lamphj closed 10 years ago
Hmm, an entity with frozen
will only skip update, not draw. How can we replicate this issue?
You're right. Re-looking at the code, I think the problem is core entity class update function. When an entity is frozen this.currentAnim is never updated.
if (!this.frozen) {
...
if (this.currentAnim) {
this.currentAnim.update();
}
}
The easiest way to reproduce the issue is to create a new Entity that extends EntityDestructable with an animSheet, and animSettings. By default I can't get the entity to show on the screen, but switching
frozen:false
on the entity will cause it to be animated on the screen.
Ah, thanks for pointing that out, and yes I can see where this would be confusing. Setting destructables to non-frozen by default seems to be a reasonable change at this point.
Dev branch includes this change.
Triggers are set to frozen:true by default and are skipped on draw(). EntityDestructable and EntityExplosion inherit from trigger and therefore are also not drawn. This is a little confusing when creating a destructable entity as they are always invisible unless you reset frozen to the EntityExtended default of false. I think it would be better to switch Destructables to not be frozen by default, or to put a warning in the docs to say EntityDestructable by default will not be drawn.