//Jose M. Pena //project 2 //moving character float x = 0; float y = 100; float speed = 2; void setup(){ size(900,700); } void draw(){ background(100,100,100); fill(127,255,127); rect(0,height/4,width,height); stroke(0); move(); display(); //set center mode //E.T's Body stroke(0); fill(255,0,0); rectMode(CENTER); rect(x,y+100, 10+35,15+50); //head fill(0,255,0); ellipse(x,y,10+80,15+70); //eye fill(100,100,100); ellipse(x,y,10,20); //pants fill(255,255,100); rect(x,y,10+35,15+50); //arm fill(0,255,0); //sun fill(0,0,100); ellipseMode(CENTER); ellipse(750,50,100,100); } void move() { x = x + speed; if (x > width) { speed= -speed; } } void display() { fill(0,255,0); ellipseMode(CENTER); ellipse(x,y,100,100); }