Spaceship spaceship1; Stars stars1; void setup(){ size(800,300); spaceship1 = new Spaceship(width-30, 20, width, 0, color(255)); stars1 = new Stars(random(width), random(height), random(8) ); background(0); smooth(); } void draw(){ frameRate(4); ellipseMode(CENTER); stars1.display(); spaceship1.display(); spaceship1.move(); } class Spaceship { color spaceshipColor; float shipcenterX; float shipcenterY; float lastshipX; float lastshipY; Spaceship(float _shipcenterX, float _shipcenterY, float _lastshipX, float _lastshipY, color _spaceshipColor) { shipcenterX= _shipcenterX; shipcenterY= _shipcenterY; spaceshipColor= _spaceshipColor; lastshipX= _lastshipX; lastshipY = _lastshipY; } void display(){ fill(0); ellipse(lastshipX, lastshipY, 50, 50); fill(spaceshipColor); noStroke(); triangle(shipcenterX-15, shipcenterY+5, shipcenterX-10, shipcenterY+5, shipcenterX-10, shipcenterY-5); quad (shipcenterX-10, shipcenterY+5, shipcenterX-10, shipcenterY-5, shipcenterX+10, shipcenterY-5, shipcenterX+10, shipcenterY+5); fill(250, 109, 28); triangle(shipcenterX+10, shipcenterY-5, shipcenterX+10, shipcenterY-1, shipcenterX+17, shipcenterY-3); triangle(shipcenterX+10, shipcenterY+5, shipcenterX+10, shipcenterY+1, shipcenterX+17, shipcenterY+3); fill(250, 0, 0); triangle(shipcenterX+10, shipcenterY-2, shipcenterX+10, shipcenterY+2, shipcenterX+17, shipcenterY); } void move(){ lastshipX=shipcenterX; lastshipY=shipcenterY; shipcenterX -=3; shipcenterY +=1; } } class Stars{ float x; float y; float a; float c; Stars(float _x, float _y, float _c) { x = _x; y= _y; c= _c; } void display(){ a = random (400); c = random (8); x = random (width); y = random(height); fill(255); noStroke(); ellipseMode (CENTER); ellipse(x, y, c, c); //draw planet fill(16, 103, 255); ellipse (width, height, 300, 300); } }