//now all of our data and functions in a class class mark { //PROPERTIES (variables local to class) PImage foleyImg; PImage logieImg; PFont foleyFont; int mvX, mvY, rotDir; int rateX, rateY; float rotRate, rotSpeed, fScale; int hitImage; //CONSTRUCTOR (what happens when on OBJ is made) mark(PImage fImg, PImage lImg, PFont fFont, int speedX, int speedY, float rot, float scl){ //stuff goes here rotDir = 1; mvX = mvY = 0; rateX = speedX; rateY = speedY; foleyFont = fFont; foleyImg = fImg; logieImg = lImg; rotSpeed = rot; fScale = scl; hitImage = 0; } //METHODS (functions local to class) //updates position and rotation direction void move(int img){ //position of foley mvX += rateX; mvY += rateY; hitImage = img; //set bounds of movement if(mvX > width || mvX < 0){ rateX *= -1; rotDir *= -1; } if(mvY > height || mvY < 0){ rateY *= -1; rotDir *= -1; } rotRate+=(rotDir * rotSpeed); } //draws text and image void drawFoley( ){ pushMatrix(); //move, rotate, and scale translate(mvX, mvY); rotate(radians(rotRate)); scale(fScale); //draw image and text if(hitImage==0){ image(foleyImg, foleyImg.width/-2, foleyImg.height/-2); }else if(hitImage==1){ image(logieImg, (logieImg.width*4)/-2, (logieImg.height*4)/-2, logieImg.width*4, logieImg.height*4); } /* textFont(foleyFont, 10); fill(255, 0, 0); text("IM FOLEY!", -25, 30); */ popMatrix(); } }