class Laser extends Sprite { PImage image; Laser(float x, float y) { this.x = x; this.y = y; image = loadImage("fire1.gif"); } void update() { y-=5; if (y<0) alive = false; } void draw() { image(image,x-image.width/2,y-image.height); } } class Explosion extends Sprite { AnimImage image; float frame = 0; Explosion(float x, float y) { this.x = x; this.y = y; image = new AnimImage(loadImage("explode1.gif"),32,32); } void update() { frame+=0.7f; if ((int)frame>=image.frames) alive = false; } void draw() { imageMode(CENTER); image.draw(x,y,(int)frame); imageMode(CORNER); } }