v0.3.0: added sprite emitter functionality to item sprites in all cases

This commit is contained in:
Evan Debenham
2015-05-26 13:22:49 -04:00
parent 153328aa86
commit 712df97bed
4 changed files with 19 additions and 9 deletions
@@ -160,6 +160,7 @@ public class ItemSprite extends MovieClip {
}
public ItemSprite view(Item item){
view(item.image(), item.glowing());
if (this.emitter != null) this.emitter.on = false;
Emitter emitter = item.emitter();
if (emitter != null && parent != null) {
@@ -167,10 +168,12 @@ public class ItemSprite extends MovieClip {
parent.add( emitter );
this.emitter = emitter;
}
return view(item.image(), item.glowing());
return this;
}
public ItemSprite view( int image, Glowing glowing ) {
if (this.emitter != null) this.emitter.on = false;
emitter = null;
frame( film.get( image ) );
if ((this.glowing = glowing) == null) {
resetColor();
@@ -178,6 +181,12 @@ public class ItemSprite extends MovieClip {
return this;
}
@Override
public void kill() {
super.kill();
if (emitter != null) emitter.on = false;
}
@Override
public void update() {
super.update();