class Scene { int HEIGHT = 400; int WIDTH = 1071; Drawable[] objects; boolean started; boolean crashed; Scene() { objects = new Drawable[0]; started = false; crashed = false; } void registerObject(Drawable obj) { objects = (Drawable[]) append(objects, obj); } void draw() { for(int i = 0; i < objects.length; i++) { if (started) { if (objects[i] instanceof Movable) ((Movable) objects[i]).move(); if (objects[i] instanceof Manipulable) ((Manipulable) objects[i]).manipulate(); } objects[i].draw(); } } void toggle() { if(started) stop(); else start(); } void stop() { started = false; } void start() { started = true; if(crashed) { crashed = false; } } void crash() { stop(); crashed = true; } }