// F22 raptor vars float f22raptorXaxis = 100; float f22raptorYaxis = 190; // missle trajectory float missleXaxis = 340; float missleYaxis = 110; // Tree Top float leafs = 40; // Tree bottom float root = 40; void setup() { size(400, 400); } void draw() { background(68, 201, 235); drawf22raptor(); movef22raptor(); drawmissle(); drawleafs(); drawroot(); } void drawf22raptor() { rectMode(CENTER); fill(115, 173, 209); noStroke(); rect(200, 20, 400, 40); fill(125, 173, 209); noStroke(); rect(200, 60, 400, 40); fill(135, 173, 209); noStroke(); rect(200, 100, 400, 40); fill(145, 173, 209); noStroke(); rect(200, 140, 400, 40); fill(155, 173, 209); noStroke(); rect(200, 180, 400, 40); fill(165, 173, 209); noStroke(); rect(200, 220, 400, 40); fill(175, 173, 209); noStroke(); rect(200, 260, 400, 40); fill(185, 173, 209); noStroke(); rect(200, 300, 400, 40); fill(195, 173, 209); noStroke(); rect(200, 340, 400, 40); fill(205, 173, 209); noStroke(); rect(200, 380, 400, 40); // front body fill(245, 190, 39); noStroke(); rect(f22raptorXaxis, f22raptorYaxis, 120, 40); // nose fill(245, 12, 16); noStroke(); rect(f22raptorXaxis+65, f22raptorYaxis, 10, 20); // bottom wing fill(122, 87, 22); noStroke(); rect(f22raptorXaxis-10, f22raptorYaxis+20, 40, 20); // rear fender fill(122, 87, 22); noStroke(); rect(f22raptorXaxis-55, f22raptorYaxis+15, 20, 10); // front fecia fill(245, 190, 39); noStroke(); rect(f22raptorXaxis-5, f22raptorYaxis+25, 90, 10); // front fecia 2 fill(245, 190, 39); noStroke(); rect(f22raptorXaxis+5, f22raptorYaxis+15, 95, 10); // exhaust fill(115, 112, 106); noStroke(); rect(f22raptorXaxis-70, f22raptorYaxis-5, 20, 10); // rear defuse fill(179, 172, 161); noStroke(); rect(f22raptorXaxis-55, f22raptorYaxis-20, 30, 20); // wing part fill(232, 229, 23); noStroke(); rect(f22raptorXaxis-25, f22raptorYaxis-25, 40, 10); //wing part 2 fill(232, 229, 23); noStroke(); rect(f22raptorXaxis-35, f22raptorYaxis-35 , 40, 10); // wing part 3 fill(232, 229, 23); noStroke(); rect(f22raptorXaxis-45,f22raptorYaxis-45 , 40, 10); // wing part 4 fill(232, 229, 23); noStroke(); rect(f22raptorXaxis-50,f22raptorYaxis-55, 30, 10); // wing part 5 fill(232, 229, 23); noStroke(); rect(f22raptorXaxis-55,f22raptorYaxis-65 , 20, 10); // wing part 6 fill(232, 229, 23); noStroke(); rect(f22raptorXaxis-60,f22raptorYaxis-75, 30, 10); // cockpit 1 fill(0,0,0); noStroke(); rect(f22raptorXaxis+25, f22raptorYaxis-15, 30, 10); // cockpit 2 fill(0,0,0); noStroke(); rect(f22raptorXaxis+15, f22raptorYaxis-25, 50, 10); // cockpit 3 fill(0,0,0); noStroke(); rect(f22raptorXaxis+10, f22raptorYaxis-35, 40, 10); // f22 afterburners fill(255, 0, 0); rect(f22raptorXaxis-80, f22raptorYaxis-5, 20, 10); // rotates rect shape really fast to mimic acutal fire } // make f22 raptor move up or down void movef22raptor() { if(keyPressed){ if(keyCode == UP){ // moves up when arrow up key is pressed f22raptorYaxis -= 3; }else if(keyCode == DOWN){ // moves down when arrow down is pressed f22raptorYaxis += 3; } } } void drawleafs() {// looping tress, top part int leafs = 40; // setting base value while ( leafs < 400) { // condition, stop when reach 400 fill(28, 105, 41); rect(leafs, 340, 40, 40); leafs = leafs + 60; // spacing } } void drawroot() { // looping trees, bottom int root = 40; while ( root < 400) { fill(26, 20, 1); rect(root, 380, 20, 40); root = root + 60; } } void drawmissle() { // drawing a missle fill(105, 95, 95); ellipse(missleXaxis, missleYaxis, 60, 10); missleXaxis -= 7; // speed of missle if (missleXaxis < -55) // when missle gets too far away from screen { missleXaxis = random(400, 300); // respawn new missle at a random set coordnates missleYaxis = random(60, 180); } }