//rotating benbat float x = 0; int y =100; //adding a vertical component int speed = 30; float rot=0; void setup() { size(1280,900); smooth(); frameRate(5); } void draw() { background(131,186,255); //float y=height/2; // Add the current speed to the x location. x = x + speed*2; y=y+speed; // Remember, || means "or." if ((x > width-250) || (x < 0)) { // If the object reaches either edge, multiply speed by -1 to turn it around. speed = speed * -1; } if ((y > height-250) || (y < 0)) { // If the object reaches either edge, multiply speed by -1 to turn it around. speed = speed * -1; } //load batboy PImage b; b = loadImage("benbat.jpg"); //image(b,x,y); //if (mousePressed==true) // { translate(x,y); rotate(rot); image(b,0,0); rot += 1.0; //} }//end of draw