float starcountX=0, starcountDX=5; creature jelly; void setup(){ jelly= new creature(400,400,50,100); background(0); size(800,800); } void draw(){ scene(); action(); } void scene(){ stars(); sea(); } void action(){ //moves creatures jelly.dx= (mouseX -jelly.x ) / 20; jelly.dy= (mouseY - jelly.y) / 20; jelly.show(); jelly.move(); } class creature{ //constructor float x=0, y=0, dx=0, dy=0; float w=0, h=0; creature( float x, float y, float w, float h ){ this.x=x; this.y=y; this.h=h; this.w=w; } //methods void move(){ x+=dx; y+=dy; } void show(){ noStroke(); //body fill(196,95,219); rectMode(CENTER); rect(x,y,w,h); //head ellipse(x,y-h/2,w,w); //eye float ez = w/3; fill(255); ellipse(x+dx,y-h/2+dy,ez,ez); //pupil fill(0); ellipse(x+dx,y-h/2+dy,ez/2,ez/2); } } void sea(){ //sea noStroke(); fill(56,112,126); rectMode(CORNER); rect(0,200,width,height); //waves fill(0); int w=0; while( w < width+50){ arc(w,200,50,25,0,PI); w = w + 50; } } void stars(){ //creats random stars strokeWeight(2); stroke(255); while(starcountX < width){ point(0+random(0,800),0+random(0,200)); starcountX+=starcountDX; } }