Alexis - L

By Alexis Nelson
float x; float ypos; float y; float direction; float speed; float speedy = 20; PImage HappyBunny; PImage HappyBunny2; void setup(){ size(600, 400); HappyBunny = loadImage("HappyBunny.png"); HappyBunny2 = loadImage("HappyBunny2.png"); } void draw() { background(255); fill(200); if (mousePressed == true) { speed = 0; ypos = mouseY; strokeWeight(3); image(HappyBunny2, mouseX - 80, ypos - 90, 130, 150); } else { speed = speedy; image(HappyBunny, mouseX - 80, ypos - 90, 130, 150); if (ypos > mouseY + 50) { direction = -1; } if (ypos < mouseY - 50) { direction = 1; } ypos = ypos + ( speed * direction ); } }

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*