/// Adrian Ortega ///Week 5 Assignment //Sleeping Beauty //when clicking pink fairy dress turns pink, when clicking blue fairy dress turns back to blue //Pudt 1203 Creative Computing //fairy initial locations float pinkInitX = 100; float pinkInitY = 200; float blueInitX = 200; float blueInitY = 100; //how much to move each fairy float pinkFMoveX = 4; float pinkFMoveY = 3; float blueFMoveX = 2; float blueFMoveY = 5; //Fairy width/height float fairyWH = 100; //dress color switch boolean dressColor = true; //true=pink, false=blue void setup() { size (600, 400); frameRate(70); } void draw() { background (255, 255, 255); fill (224, 0, 0); rect (0, 300, 600, 200); PImage blueDress; blueDress = loadImage("bluedress.png"); PImage blueFairy; blueFairy = loadImage("realbluefairy.png"); image(blueFairy, blueInitX, blueInitY); PImage pinkDress; pinkDress = loadImage("pinkdress.png"); PImage pinkFairy; pinkFairy = loadImage("realpinkfairy.png"); image(pinkFairy, pinkInitX, pinkInitY); pinkInitX = pinkInitX + pinkFMoveX; pinkInitY = pinkInitY + pinkFMoveY; blueInitX = blueInitX + blueFMoveX; blueInitY = blueInitY + blueFMoveY; if(dressColor==true) { image(pinkDress, 50, 10); } if (dressColor==false) { image(blueDress, 50, 10); } ///////////pink bounce if (pinkInitX > width - fairyWH) { pinkFMoveX = -abs(pinkFMoveX); } if (pinkInitX < 0) { pinkFMoveX = abs(pinkFMoveX); } if (pinkInitY > height - fairyWH) { pinkFMoveY = -abs(pinkFMoveY); } if (pinkInitY < 0) { pinkFMoveY = abs(pinkFMoveY); } ///////////blue bounce if (blueInitX > width - fairyWH) { blueFMoveX = -abs(blueFMoveX); } if (blueInitX < 0) { blueFMoveX = abs(blueFMoveX); } if (blueInitY > height - fairyWH) { blueFMoveY = -abs(blueFMoveY); } if (blueInitY < 0) { blueFMoveY = abs(blueFMoveY); } //dress shine noStroke(); fill (330, 255, 0); ellipse(300 + random(-10, 10), 150 + random(-10, 10), 7, 7); fill (330, 255, 0); ellipse(260 + random(-10, 10), 200 + random(-10, 10), 5, 5); fill (255, 255, 0); ellipse(260 + random(-5, 5), 210 + random(-5, 5), 7, 7); fill (255, 255, 0); ellipse(310 + random(-5, 5), 220 + random(-5, 5), 7, 7); fill (255, 255, 0); ellipse(250 + random(-10, 10), 230 + random(10, 10), 7, 7); fill (255, 255, 0); ellipse(250 + random(-8, 8), 240 + random(-8, 8), 2, 2); fill (255, 255, 0); ellipse(250 + random(-5, 5), 250 + random(-5, 5), 7, 7); fill (255, 255, 0); ellipse(250 + random(-10, 10), 260 + random(-10, 10), 7, 7); fill (310, 255, 0); ellipse(300 + random(-9, 9), 270 + random(-9, 9), 7, 7); fill (255, 255, 0); ellipse(360 + random(-5, 5), 280 + random(-5, 5), 7, 7); fill (255, 255, 0); ellipse(378 + random(-5, 5), 300 + random(-5, 5), 6, 6); fill (255, 255, 0); ellipse(250 + random(-5, 5), 300 + random(-5, 5), 7, 7); fill (255, 255, 0); ellipse(250 + random(-5, 5), 310 + random(-5, 5), 4, 4); fill (255, 255, 0); ellipse(255 + random(-5, 5), 320 + random(-5, 5), 3, 3); fill (255, 255, 0); ellipse(260 + random(-6, 6), 330 + random(-6, 6), 7, 7); fill (300, 255, 0); ellipse(304 + random(-6, 6), 340 + random(-6, 6), 7, 7); fill (255, 255, 0); ellipse(310 + random(-8, 8), 350 + random(-8, 8), 9, 9); fill (320, 255, 0); ellipse(320 + random(-6, 6), 330 + random(-6, 6), 7, 7); fill (255, 255, 0); ellipse(210 + random(-6, 6), 320 + random(-6, 6), 7, 7); fill (255, 255, 0); ellipse(350 + random(-10, 10), 320 + random(-10, 10), 7, 7); { textSize (75); text("Sleeping", 100, 70); fill(0,0,0); text ("Beauty",100, 100);} fill(0,0,0); } void mouseReleased() { if(mouseX> pinkInitX && mouseX < pinkInitX + fairyWH && mouseY> pinkInitY && mouseY < pinkInitY + fairyWH) { dressColor = !dressColor; } if(mouseX> blueInitX && mouseX < blueInitX + fairyWH && mouseY> blueInitY && mouseY < blueInitY + fairyWH) { dressColor = !dressColor; } }