/* IAT 800, Fall 2009 Final Project: "Map Skill for Children" Instructor: Chris Shaw Teaching Assistant: Pooya Amini Student: Leila Aflatoony "Drag each shape to the right position on the map. If you fail to find the right position, the shape will reurn to the previous position by releasing the mouse button. Click on the the flag button to choose another Map." */ Container c1 = new Container(5, 5); Container c2 = new Container(0, 215); Container c3 = new Container(5, 400); Container c4 = new Container(130, 5); Container c5 = new Container(125, 215); Container c6 = new Container(165, 400); Container can1 = new Container(5, 5); Container can2 = new Container(185, 5); Container can3 = new Container(305, 5); Container can4 = new Container(5, 205); Container can5 = new Container(185, 205); Container can6 = new Container(305, 205); Container can7 = new Container(5, 365); Container can8 = new Container(185, 365); Container can9 = new Container(305, 365); Container can10 = new Container(5, 500); Container can11 = new Container(190, 500); Container can12 = new Container(260, 500); Container can13 = new Container(325, 500); Continent continents[]; Continent cStates[]; PImage b; PImage a; PImage c; PImage d; PImage e; PImage f; PImage g; PImage canImage; PImage worldImage; PImage ca; PImage cb; PImage cc; PImage cd; PImage ce; PImage cf; PImage cg; PImage ch; PImage ci; PImage cj; PImage ck; PImage cl; PImage cm; PImage cn; int currentContinent=0; int mode=0;//0-World 1-Canada void setup(){ size(1100, 597); background(255); smooth(); cursor(HAND); fill(255); PFont font; font = loadFont ("Swiss721BT-BlackRounded-40.vlw"); textFont(font,48); continents=new Continent[6]; cStates=new Continent[13]; if (mode==0){ c1.drawContainer(); c2.drawContainer(); c3.drawContainer(); c4.drawContainer(); c5.drawContainer(); c6.drawContainer(); } else if (mode==1){ can1.drawContainer(); can2.drawContainer(); can3.drawContainer(); can4.drawContainer(); can5.drawContainer(); can6.drawContainer(); can7.drawContainer(); can8.drawContainer(); can9.drawContainer(); can10.drawContainer(); can11.drawContainer(); can12.drawContainer(); can13.drawContainer(); } b = loadImage("south.png"); continents[0]=new Continent(10,20,b,"South America",544,216); c = loadImage("asia.png"); continents[1]=new Continent(140,10,c,"asia",761,80); d = loadImage("australia.png"); continents[2]=new Continent(6,240,d,"australia",930,254); e = loadImage("north.png"); continents[3]=new Continent(125,220,e,"north",437,72); f = loadImage("europe.png"); continents[4]=new Continent(15,450,f,"europe",695,92); g = loadImage("africa.png"); continents[5]=new Continent(200,420,g,"africa",678,165); canImage = loadImage ("flagcanada.png"); worldImage = loadImage ("flagworld.png"); a = loadImage("continent.png"); ca = loadImage ("canada.png"); cb = loadImage("a1.png"); cStates[0]=new Continent(5,10,cb,"a1",634,99); cc = loadImage("a2.png"); cStates[1]=new Continent(195,50,cc,"a2",766,254); cd = loadImage("a3.png"); cStates[2]=new Continent(330,60,cd,"a3",670,281); ce = loadImage("a4.png"); cStates[3]=new Continent(50,210,ce,"a4",593,142); cf = loadImage("a5.png"); cStates[4]=new Continent(215,225,cf,"a5",555,229); cg = loadImage("a6.png"); cStates[5]=new Continent(310,240,cg,"a6",623,278); ch = loadImage("a7.png"); cStates[6]=new Continent(40,375,ch,"a7",704,305); ci = loadImage("a8.png"); cStates[7]=new Continent(210,385,ci,"a8",552,171); cj = loadImage("a9.png"); cStates[8]=new Continent(325,385,cj,"a9",600,266); ck = loadImage("a10.png"); cStates[9]=new Continent(45,510,ck,"a10",815,257); cl = loadImage("a11.png"); cStates[10]=new Continent(192,527,cl,"a11",839,319); cm = loadImage("a12.png"); cStates[11]=new Continent(270,520,cm,"a12",858,333); cn = loadImage("a13.png"); cStates[12]=new Continent(340,520,cn,"a13",833,322); fill(255); stroke(255); } void draw(){ println(mouseX+" "+mouseY); if(mode==0){ image(a, 0, 0); for(int i=0;i= 5 && mouseX <= 115 && mouseY >= 5 && mouseY <= 200 && currentContinent==0){ //south america currentContinent=1; } if(mouseX >= 125 && mouseX <= 260 && mouseY >= 5 && mouseY <= 200 && currentContinent==0){ //asia currentContinent=2; } if(mouseX >= 0 && mouseX <= 115 && mouseY >= 215 && mouseY <= 390 && currentContinent==0){ //australia currentContinent=3; } if(mouseX >= 130 && mouseX <= 270 && mouseY >= 215 && mouseY <= 390 && currentContinent==0){ //north america currentContinent=4; } if(mouseX >= 5 && mouseX <= 150 && mouseY >= 400 && mouseY <= 590 && currentContinent==0){ //europe currentContinent=5; } if(mouseX >= 165 && mouseX <= 355 && mouseY >= 400 && mouseY <= 590 && currentContinent==0){ //africa currentContinent=6; } }else if (mode==1){ if(mouseX >= 5 && mouseX <= 185 && mouseY >= 5 && mouseY <= 205 && currentContinent==0){ //a1 currentContinent=1; } if(mouseX >= 190 && mouseX <= 300 && mouseY >= 5 && mouseY <= 205 && currentContinent==0){ //a2 currentContinent=2; } if(mouseX >= 305 && mouseX <= 395 && mouseY >= 5 && mouseY <= 205 && currentContinent==0){ //a3 currentContinent=3; } if(mouseX >= 5 && mouseX <= 185 && mouseY >= 205 && mouseY <= 365 && currentContinent==0){ //a4 currentContinent=4; } if(mouseX >= 185 && mouseX <= 305 && mouseY >= 205 && mouseY <= 365 && currentContinent==0){ //a5 currentContinent=5; } if(mouseX >= 305 && mouseX <= 395 && mouseY >= 205 && mouseY <= 365 && currentContinent==0){ //a6 currentContinent=6; } if(mouseX >= 5 && mouseX <= 185 && mouseY >= 365 && mouseY <= 500 && currentContinent==0){ //a7 currentContinent=7; } if(mouseX >= 185 && mouseX <= 305 && mouseY >= 365 && mouseY <= 500 && currentContinent==0){ //a8 currentContinent=8; } if(mouseX >= 305 && mouseX <= 395 && mouseY >= 365 && mouseY <= 500 && currentContinent==0){ //a9 currentContinent=9; } if(mouseX >= 5 && mouseX <= 185 && mouseY >= 500 && mouseY <= 595 && currentContinent==0){ //a10 currentContinent=10; } if(mouseX >= 187 && mouseX <= 260 && mouseY >= 500 && mouseY <= 595 && currentContinent==0){ //a11 currentContinent=11; } if(mouseX >= 260 && mouseX <= 325 && mouseY >= 500 && mouseY <= 595 && currentContinent==0){ //a12 currentContinent=12; } if(mouseX >= 325 && mouseX <= 395 && mouseY >= 500 && mouseY <= 595 && currentContinent==0){ //a13 currentContinent=13; } } } image(canImage,600,470); image(worldImage,470,470); if ( mode==0){ text("CONTINENTS", 410, 50); } else if ( mode==1){ text("CANADA", 410, 50); } } void mouseReleased(){ int puzzleSize=0; if(mode==0){ puzzleSize=continents.length; for(int i=0;icontinents[i].correctX-10 && continents[i].ycontinents[i].correctY-10){ continents[i].x=continents[i].correctX; continents[i].y=continents[i].correctY; }else{ continents[i].x=continents[i].initialX; continents[i].y=continents[i].initialY; } } } }else if(mode==1){ puzzleSize=cStates.length; for(int i=0;icStates[i].correctX-10 && cStates[i].ycStates[i].correctY-10){ cStates[i].x=cStates[i].correctX; cStates[i].y=cStates[i].correctY; }else{ cStates[i].x=cStates[i].initialX; cStates[i].y=cStates[i].initialY; } } } } currentContinent=0; } void mouseClicked(){ if(mouseX>470 && mouseX<540 && mouseY>470 && mouseY<532){ mode=0; } else if(mouseX>600 && mouseX<670 && mouseY>470 && mouseY<530){ mode=1; } } void mouseDragged(){ int puzzleSize=0; if(mode==0){ puzzleSize=continents.length; for(int i=0;i