public class Sprite { int x,y; PImage img; float s; int layer; public Sprite( PImage img, int x, int y, float s, int layer ) { this.img = img; this.x = x; this.y = y; this.s = s; this.layer = layer; } public void moveBy( int x, int y) { this.x += x; this.y += y; } public void draw() { image( img, x, 300 - y - img.height * s, img.width * s, img.height * s ); } public boolean isVisible() { return x + img.width * s > 0; } }