Beth - L

By Elizabeth
Monster m; void setup() { size(600, 400); smooth(); noCursor(); m = new Monster (100, 200, .50, .50, "monster.png"); } void draw() { background(255); m.move(mouseX, mouseY); m.display(); } void mouseDragged () { } class Monster{ PImage monster; float x; float y; float speedX = 1.0; float speedY = 0.4; Monster(float inx, float iny, float inspeedX, float inspeedY, String imagename) { x = inx; y = iny; speedX = inspeedX; speedY = inspeedY; monster = loadImage(imagename); } void move(float mX, float mY) { x = mX; y = mY; } void display(){ //image(monster, x, y); if (mousePressed == true) { x = random(0, 600); y = random(0, 400); //tint(255, 100); } image(monster, x, y); } }

Post a Comment

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

*
*