/* TITLE:BABY'S GET AWAY BY:DAVID D'ORAZIO DATE:10/2/2017 THIS IS A GAME WHERE YOU MUST RUN AWAYY FROM THE COPS AVOIDING OBSTACLES CONTROLS:ARROW KEYS TO MOVE LEFT AND RIGHT */ //////////////////////////////////////////////////////////////////////COLOUR VALUES START //font cream colour int creamColourR = 226; int creamColourG= 210; int creamColourB = 167; //pixel baby int jacketBlk = 0; int jacketDrkGrey = 40; int jacketGrey = 59; int jacketDrkCreamR = 219 ; int jacketDrkCreamG = 214 ; int jacketDrkCreamB = 176 ; int jacketCreamR = 227; int jacketCreamG = 223; int jacketCreamB = 193; int skinLightR = 249; int skinLightG = 206; int skinLightB= 185; int skinDarkR = 247; int skinDarkG = 188; int skinDarkB = 160; int ipodScreen = 225; int earphones = 255; int hairDarkR = 49; int hairDarkG = 19; int hairDarkB = 18; int hairMidR = 95; int hairMidG = 36; int hairMidB = 35; int hairLightR = 135; int hairLightG = 52; int hairLightB = 50; //road int sideRoadGrey = 65; int roadDivider = 127; //cars int policeCarLightR = 35; int policeCarLightG = 43; int policeCarLightB = 131; int policeCarDarkR = 27; int policeCarDarkG = 32; int policeCarDarkB = 99; int policeWindSheildLight = 59; int policeWindShieldDark = 40; int headLightsR = 255; int headLightsG = 202; int headLightsB = 17; int SirenGrey = 195; //same colour as light red on car int SirenRedR = 210; int SirenRedG = 0; int SirenRedB = 32; //same colour as light red on car int SirenBlueR = 0; int SirenBlueG = 85; int SirenBlueB = 170; int darkRedCarR = 173; int darkRedCarG = 0; int darkRedCarB = 26; //land divider yellow int dividerR = 223; int dividerG = 173; int dividerB = 0; //obstacle colours int pylonOrangeR = 240; int pylonOrangeG =96; int pylonOrangeB = 0; int pylonOrangeLightR = 255; int pylonOrangeLightG =127; int pylonOrangeLightB = 39; int potholedark = 51; int pothole = 81; //////////////////////////////////////////////////////////////////////COLOUR VALUES END //////////////////////////////////////////////////////////////////////VARIABLES FOR THE ROAD DIVIDERS AND CAR & OBSTACLES START float carOffset; float laneSpeed = 0; int offset = -40; float obstacleXPos; float obstacleYPos = -200; int obstacleLane; int obstacleID; //////////////////////////////////////////////////////////////////////VARIABLES FOR THE ROAD DIVIDERS AND CAR END //////////////////////////////////////////////////////////////////////BOOLEAN MENU VALUES START //Main Menu boolean play = false; boolean gameRules = false; boolean back = false; boolean playerLost = false; //////////////////////////////////////////////////////////////////////BOOLEAN MENU VALUES END //////////////////////////////////////////////////////////////////////SETTING INITIAL BACKGROUND COLOURS & SETUP START void setup() { size(400, 400); } //set the background title screen void draw() { noStroke(); background(223, 63, 110); //////////////////////////////////////////////////////////////////////SETTING INITIAL BACKGROUND COLOURS & SETUP END //////////////////////////////////////////////////////////////////////SUBARU (RED CAR) CONTROLS START if (keyPressed) { if (keyCode==LEFT && carOffset > -130) carOffset -= 3; if (keyCode == RIGHT && carOffset < 130) carOffset += 3; } //////////////////////////////////////////////////////////////////////SUBARU (RED CAR) CONTROLS END //////////////////////////////////////////////////////////////////////BOOLEAN SWITCHING AROUND MENUS START //Main Menu if (gameRules == false) { background(223, 63, 110); titleScreen(); } //Rules screen if (gameRules == true) { background(223, 63, 110); callGameRules(); } //starts the game if (play == true) { background(148); gameScreen(); Obstacles(); policeCar(); laneDivider(); subaru(); carHitBox(); } if (playerLost == true) { gameOver(); } } //////////////////////////////////////////////////////////////////////BOOLEAN SWITCHING AROUND MENUS END //////////////////////////////////////////////////////////////////////MOUSE BUTTONS TO DIRECT YOU ON MAIN MENU START void mouseClicked() { //rules click hitbox if (mouseX > 190 && mouseX < 350 && mouseY > 330 && mouseY < 390) { gameRules = true; back = false; } //play click hitbox if (mouseX > 190 && mouseX < 350 && mouseY > 260 && mouseY < 320) { play = true; } //back arrow click hitbox if (mouseX > 10 && mouseX < 80 && mouseY > 330 && mouseY < 390) { back = true; gameRules = false; } } //////////////////////////////////////////////////////////////////////MOUSE BUTTONS TO DIRECT YOU ON MAIN MENU END void carHitBox() { if (abs(obstacleXPos-carOffset)<25 && abs(obstacleYPos-220)<50) { playerLost = true; background(223, 63, 110); gameOver(); } } //////////////////////////////////////////////////////////////////////GAMES TITLE SCREEN (WITH BABY ON IT) END void titleScreen() { //Letter B rectMode(CORNERS); noStroke(); background(223, 63, 110); fill(creamColourR, creamColourG, creamColourB); rect(20, 20, 50, 30); //middle of letter rect(20, 50, 50, 60); //bottom of leter rect(20, 80, 50, 90); //back of b rect(20, 20, 30, 90); //top hump rect(50, 30, 60, 50); //bottom hump rect(50, 60, 60, 80); //////////////////////////////////letter A //top of letter rect(80, 20, 100, 30); //left side of letter rect(70, 30, 80, 90); //middle of letter rect(70, 50, 110, 60); //right side of letter rect(100, 30, 110, 90); /////////////////////////////// letter B rect(120, 20, 150, 30); //middle of letter rect(120, 50, 150, 60); //bottom of leter rect(120, 80, 150, 90); //back of b rect(120, 20, 130, 90); //top hump rect(150, 30, 160, 50); //bottom hump rect(150, 60, 160, 80); /////////////////////////////// letter Y //left side rect(170, 20, 180, 50); //right side rect(190, 20, 200, 50); //middle rect(180, 50, 190, 90); ////////////////////////////// ' rect(210, 10, 220, 30); ///////////////////////////// letter S //top of letter rect(240, 20, 270, 30); //left top rect(230, 30, 240, 50); //bottom of leter rect(240, 50, 260, 60); //right bottom rect(260, 60, 270, 80); //bottom of letter rect(230, 80, 260, 90); ////////////////////////////// middle word (GET) /////////////////////letter G //top of letter rect(170, 100, 200, 110); //left rect(160, 110, 170, 160); //bottom of letter rect(170, 160, 200, 170); //right rect(190, 140, 200, 170); //g hook in part rect(180, 140, 200, 150); /////////////////////letter E //top of letter rect(210, 100, 250, 110); //middle rect(220, 130, 240, 140); //bottom rect(210, 160, 250, 170); //back rect(210, 100, 220, 170); /////////////////////Letter T //top of letter rect(260, 100, 310, 110); //middle rect(280, 110, 290, 170); ///////////////////////////////////bottom word (AWAY) //////////////////////////////////letter A //top of letter rect(170, 180, 190, 190); //left side of letter rect(160, 190, 170, 250); //middle of letter rect(170, 210, 190, 220); //right side of letter rect(190, 190, 200, 250); //////////////////////////////////letter W //1st wall (left to right) rect(210, 180, 220, 240); //2nd wall rect(220, 240, 230, 250); //middle of letter rect(230, 210, 240, 240); //4th wall rect(240, 240, 250, 250); //5th wall rect(250, 180, 260, 240); //////////////////////////////////letter A //top of letter rect(280, 180, 300, 190); //left side of letter rect(270, 190, 280, 250); //middle of letter rect(280, 210, 300, 220); //right side of letter rect(300, 190, 310, 250); /////////////////////////////// letter Y //left side rect(320, 180, 330, 210); //right side rect(340, 180, 350, 210); //middle rect(330, 210, 340, 250); ////////////////////////////////////////Pixel Baby //jacket //blk outline fill(jacketBlk); rect(20, 310, 30, 400); rect(30, 300, 40, 310); rect(40, 290, 70, 300); rect(70, 300, 110, 310); rect(110, 310, 120, 330); rect(120, 330, 130, 370); //light grey jacket part fill(jacketGrey); rect(30, 310, 110, 400); rect(110, 330, 120, 370); rect(40, 300, 70, 310); //dark grey jacket part fill(jacketDrkGrey); rect(30, 320, 40, 330); rect(40, 330, 50, 340); rect(30, 380, 40, 400); rect(50, 300, 60, 320); rect(60, 310, 70, 320); rect(90, 310, 100, 330); rect(100, 330, 110, 340); rect(110, 340, 120, 350); //cream arm jacket fill(jacketCreamR, jacketCreamG, jacketCreamB); rect(60, 320, 90, 400); rect(90, 370, 130, 400); rect(50, 280, 80, 290); rect(70, 290, 110, 300); //dark cream jacket fill(jacketDrkCreamR, jacketDrkCreamG, jacketDrkCreamB); rect(50, 330, 60, 400); rect(60, 320, 70, 350); rect(60, 360, 70, 370); rect(70, 320, 90, 330); rect(80, 330, 90, 360); rect(90, 360, 100, 370); rect(100, 370, 130, 380); rect(100, 390, 120, 400); rect(70, 370, 80, 390); rect(80, 380, 90, 390); rect(60, 280, 70, 290); rect(70, 290, 90, 300); rect(100, 290, 110, 300); rect(130, 380, 140, 400); //////////////////////////////Baby's Skin fill(skinLightR, skinLightG, skinLightB); rect(60, 220, 130, 280); rect(130, 250, 140, 260); rect(150, 370, 160, 400); rect(160, 390, 170, 400); rect(80, 280, 100, 290); ///////////////////////////////////////Darker Skin fill (skinDarkR, skinDarkG, skinDarkB); rect(140, 370, 150, 400); rect(160, 380, 170, 390); rect (60, 270, 70, 280); rect(80, 250, 90, 260); rect(90, 240, 100, 250); rect(100, 280, 110, 290); //////////////////////////Sun glasses fill(jacketBlk); rect(90, 230, 140, 240); rect(130, 240, 140, 250); //////////////////////////Ipod rect(140, 340, 180, 370); rect(160, 370, 180, 380); rect (170, 380, 180, 400); fill(ipodScreen); rect(150, 350, 170, 370); ///////////////////////////ear phones fill(earphones); rect(90, 250, 100, 270); rect(100, 270, 110, 280); rect(110, 280, 120, 290); rect(120, 290, 130, 300); rect(130, 300, 140, 320); rect(140, 320, 150, 330); rect(150, 330, 160, 340); //////////////////////////Baby's eye rect(110, 240, 120, 250); fill(policeCarLightR, policeCarLightG, policeCarLightB); rect(120, 240, 130, 250); ///////////////////////////////Hair fill(hairLightR, hairLightG, hairLightB); rect(70, 190, 120, 220); rect(50, 220, 90, 250); //mid colour hair fill(hairMidR, hairMidG, hairMidB); rect(60, 210, 70, 230); rect(70, 200, 80, 210); rect(90, 190, 100, 200); rect(110, 200, 130, 210); //darkest hair fill(hairDarkR, hairDarkG, hairDarkB); rect(40, 230, 50, 260); rect(50, 250, 70, 270); rect(60, 240, 70, 250); rect(70, 230, 90, 250); rect(80, 220, 110, 230); rect(100, 210, 140, 220); rect(130, 200, 140, 220); rect(120, 190, 130, 200); rect(90, 180, 120, 190); rect(70, 190, 90, 200); rect(60, 200, 70, 210); rect(50, 210, 60, 230); /////music notes //top one fill(jacketBlk); rect(50, 120, 60, 130); rect(60, 100, 70, 130); rect(70, 100, 80, 110); //right one rect(90, 150, 100, 160); rect(100, 130, 110, 160); rect(110, 130, 120, 140); //left one rect(40, 170, 50, 180); rect(50, 150, 60, 180); rect(60, 150, 70, 160); ///////////////////////////////////////////PLAY fill(creamColourR, creamColourG, creamColourB); //P rect(200, 260, 210, 310); rect(210, 260, 220, 270); rect(210, 280, 220, 290); rect(220, 270, 230, 280); //L rect(240, 260, 250, 310); rect(250, 300, 270, 310); //A rect(280, 270, 290, 310); rect(290, 260, 300, 270); rect(290, 280, 300, 290); rect(300, 270, 310, 310); //Y rect(320, 260, 330, 280); rect(330, 280, 340, 310); rect(340, 260, 350, 280); //Underline fill(jacketBlk); rect(200, 310, 350, 320); ///////////////////////////////////////////RULES fill(creamColourR, creamColourG, creamColourB); //R rect(200, 330, 210, 380); rect(210, 330, 220, 340); rect(210, 350, 220, 360); rect(220, 340, 230, 350); rect(220, 360, 230, 380); //U rect(240, 330, 250, 380); rect(250, 370, 260, 380); rect(260, 330, 270, 380); //L rect(280, 330, 290, 380); rect(290, 370, 310, 380); //E rect(320, 330, 330, 380); rect(330, 330, 350, 340); rect(330, 350, 340, 360); rect(330, 370, 350, 380); //S rect(370, 330, 390, 340); rect(360, 340, 370, 350); rect(360, 350, 390, 360); rect(380, 360, 390, 370); rect(360, 370, 380, 380); //UNderline fill(jacketBlk); rect(200, 380, 390, 390); } //////////////////////////////////////////////////////////////////////GAMES TITLE SCREEN (WITH BABY ON IT) END //////////////////////////////////////////////////////////////////////GAMES RULES / CONTROL'S SCREEN START void callGameRules() { rectMode(CORNERS); background(223, 63, 110); fill (creamColourR, creamColourG, creamColourB); //A rect(110, 20, 120, 30); rect(100, 30, 110, 70); rect(110, 40, 120, 50); rect(120, 30, 130, 70); //V rect(140, 20, 150, 60); rect(150, 60, 160, 70); rect(160, 20, 170, 60); //O rect(180, 30, 190, 60); rect(190, 20, 200, 30); rect(190, 60, 200, 70); rect(200, 30, 210, 60); //I rect(220, 20, 250, 30); rect(230, 30, 240, 60); rect(220, 60, 250, 70); //D rect(260, 20, 270, 70); rect(270, 20, 280, 30); rect(270, 60, 280, 70); rect(280, 30, 290, 60); ///////////////////////Avoid //O rect(20, 90, 30, 120); rect(30, 80, 40, 90); rect(30, 120, 40, 130); rect(40, 90, 50, 120); //B rect(60, 80, 80, 90); rect(70, 100, 80, 110); rect(70, 120, 80, 130); rect(60, 80, 70, 130); rect(80, 90, 90, 100); rect(80, 110, 90, 120); //S rect(110, 80, 130, 90); rect(100, 90, 110, 100); rect(100, 100, 130, 110); rect(120, 110, 130, 120); rect(100, 120, 120, 130); //T rect(140, 80, 170, 90); rect(150, 90, 160, 130); //A rect(190, 80, 200, 90); rect(180, 90, 190, 130); rect(190, 100, 200, 110); rect(200, 90, 210, 130); //C rect(220, 80, 230, 130); rect(230, 80, 250, 90); rect(220, 120, 250, 130); //L rect(260, 80, 270, 130); rect(260, 120, 290, 130); //E rect(300, 80, 330, 90); rect(300, 100, 320, 110); rect(300, 120, 330, 130); rect(300, 80, 310, 130); //S rect(350, 80, 370, 90); rect(340, 90, 350, 110); rect(350, 100, 370, 110); rect(360, 110, 370, 120); rect(340, 120, 360, 130); ///////////////////////////////////////////Obstacles rect(70, 160, 80, 210); rect(60, 170, 70, 200); rect(50, 180, 60, 190); rect(50, 180, 110, 190); /////////////////////left arrow //K rect(120, 160, 130, 210); rect(130, 180, 140, 190); rect(140, 170, 150, 180); rect(150, 160, 160, 170); rect(140, 190, 150, 200); rect(150, 200, 160, 210); //E rect(170, 160, 180, 210); rect(180, 160, 200, 170); rect(180, 180, 190, 190); rect(180, 200, 200, 210); //Y rect(210, 160, 220, 180); rect(220, 180, 230, 210); rect(230, 160, 240, 180); //S rect(260, 160, 280, 170); rect(250, 170, 260, 180); rect(250, 180, 280, 190); rect(270, 190, 280, 200); rect(250, 200, 270, 210); ////////////////////////Keys rect(290, 180, 350, 190); rect(320, 160, 330, 210); rect(330, 170, 340, 200); //////////////////////right arrow //T rect(60, 230, 90, 240); rect(70, 240, 80, 280); //O rect(100, 240, 110, 270); rect(110, 230, 120, 240); rect(110, 270, 120, 280); rect(120, 240, 130, 270); ///////////////////////To //D rect(150, 230, 160, 280); rect(160, 230, 170, 240); rect(160, 270, 170, 280); rect(170, 240, 180, 270); //R rect(190, 230, 200, 280); rect(200, 230, 210, 240); rect(200, 250, 210, 260); rect(210, 240, 220, 250); rect(210, 260, 220, 280); //I rect(230, 230, 260, 240); rect(240, 240, 250, 270); rect(230, 270, 260, 280); //V rect(270, 230, 280, 270); rect(280, 270, 290, 280); rect(290, 230, 300, 270); //E rect(310, 230, 340, 240); rect(310, 230, 320, 280); rect(320, 250, 330, 260); rect(320, 270, 340, 280); //back arrow rect(10, 350, 80, 360); rect(20, 340, 30, 370); rect(30, 330, 40, 380); //underline fill(jacketBlk); rect(10, 380, 80, 390); } //////////////////////////////////////////////////////////////////////GAMES RULES / CONTROL'S SCREEN END //////////////////////////////////////////////////////////////////////DRAW GAME SCREEN (ROAD) START void gameScreen() { fill (sideRoadGrey); rect(0, 0, 20, 400); rect(380, 0, 400, 400); fill (roadDivider); rect(20, 0, 30, 400); rect(370, 0, 380, 400); } //////////////////////////////////////////////////////////////////////DRAW GAME SCREEN (ROAD) END //////////////////////////////////////////////////////////////////////DRAW POLICE CAR START void policeCar() { rectMode(CORNERS); //////////////////////////////////////////////////////////////////////POLICE CAR 1 START //light blue police car fill(policeCarLightR, policeCarLightG, policeCarLightB); rect(60, 320, 100, 400); //police car head lights fill(headLightsR, headLightsG, headLightsB); rect(60, 310, 100, 320); //dark blue police car fill(policeCarDarkR, policeCarDarkG, policeCarDarkB); rect(50, 320, 60, 370); rect(70, 310, 90, 320); rect(100, 320, 110, 370); rect(70, 310, 90, 320); rect(60, 380, 70, 390); rect(60, 370, 100, 380); rect(90, 380, 100, 390); rect(40, 370, 50, 380); rect(110, 370, 120, 380); rect(70, 330, 90, 340); //dark grey police car border fill(policeWindShieldDark); rect(50, 370, 60, 400); rect(60, 350, 70, 370); rect(90, 350, 100, 370); rect(100, 370, 110, 400); //light windsheild colour fill(policeWindSheildLight); rect(70, 350, 90, 370); //police siren grey part fill(SirenGrey); rect(70, 390, 90, 400); //red siren light fill(SirenRedR, SirenRedG, SirenRedB); rect(60, 390, 70, 400); //blue siren light fill(SirenBlueR, SirenBlueG, SirenBlueB); rect(90, 390, 100, 400); //////////////////////////////////////////////////////////////////////POLICE CAR 1 END //////////////////////////////////////////////////////////////////////POLICE CAR 2 START //light blue police car fill(policeCarLightR, policeCarLightG, policeCarLightB); rect(170, 320, 230, 400); //police car head lights fill(headLightsR, headLightsG, headLightsB); rect(180, 310, 220, 320); //dark blue police car fill(policeCarDarkR, policeCarDarkG, policeCarDarkB); rect(190, 310, 210, 320); rect(170, 320, 180, 370); rect(220, 320, 230, 370); rect(180, 380, 190, 390); rect(160, 370, 240, 380); rect(210, 380, 220, 390); rect(190, 330, 210, 340); //dark grey police car border fill(policeWindShieldDark); rect(170, 370, 180, 400); rect(220, 370, 230, 400); rect(180, 350, 220, 370); //light windsheild colour fill(policeWindSheildLight); rect(190, 350, 210, 370); //police siren grey part fill(SirenGrey); rect(190, 390, 210, 400); //red siren light fill(SirenRedR, SirenRedG, SirenRedB); rect(180, 390, 190, 400); //blue siren light fill(SirenBlueR, SirenBlueG, SirenBlueB); rect(210, 390, 220, 400); //////////////////////////////////////////////////////////////////////POLICE CAR 2 END //////////////////////////////////////////////////////////////////////POLICE CAR 3 START //light blue police car fill(policeCarLightR, policeCarLightG, policeCarLightB); rect(290, 320, 350, 400); //police car head lights fill(headLightsR, headLightsG, headLightsB); rect(300, 310, 340, 320); //dark blue police car fill(policeCarDarkR, policeCarDarkG, policeCarDarkB); rect(310, 310, 330, 320); rect(290, 320, 300, 370); rect(340, 320, 350, 370); rect(300, 380, 310, 390); rect(280, 370, 360, 380); rect(330, 380, 340, 390); rect(310, 330, 330, 340); //dark grey police car border fill(policeWindShieldDark); rect(290, 370, 300, 400); rect(340, 370, 350, 400); rect(300, 350, 340, 370); //light windsheild colour fill(policeWindSheildLight); rect(310, 350, 330, 370); //police siren grey part fill(SirenGrey); rect(310, 390, 330, 400); //red siren light fill(SirenRedR, SirenRedG, SirenRedB); rect(300, 390, 310, 400); //blue siren light fill(SirenBlueR, SirenBlueG, SirenBlueB); rect(330, 390, 340, 400); //////////////////////////////////////////////////////////////////////POLICE CAR 3 END } //////////////////////////////////////////////////////////////////////DRAW POLICE CAR END //////////////////////////////////////////////////////////////////////DRAW AND MOVE SUBARU (RED CAR) START void subaru() { rectMode(CENTER); fill(darkRedCarR, darkRedCarG, darkRedCarB); //dark red body of car rect(200+carOffset, 220, 60, 120); rect(200+carOffset, 220, 40, 140); rect(200+carOffset, 215, 80, 10); //light red interior of car fill(SirenRedR, SirenRedG, SirenRedB); rect(200+carOffset, 275, 40, 10); rect(200+carOffset, 235, 20, 30); rect(200+carOffset, 235, 40, 10); rect(200+carOffset, 165, 40, 10); rect(200+carOffset, 185, 40, 10); rect(185+carOffset, 175, 10, 10); rect(215+carOffset, 175, 10, 10); //dark windows of car fill(policeWindShieldDark); rect(185+carOffset, 200, 10, 20); rect(215+carOffset, 200, 10, 20); rect(175+carOffset, 235, 10, 50); rect(225+carOffset, 235, 10, 50); rect(200+carOffset, 265, 40, 10); //light grey of windshield fill(policeWindSheildLight); rect(200+carOffset, 200, 20, 20); rect(200+carOffset, 235, 20, 10); rect(200+carOffset, 265, 20, 10); //headlights fill(headLightsR, headLightsG, headLightsB); rect(185+carOffset, 155, 10, 10); rect(215+carOffset, 155, 10, 10); } //////////////////////////////////////////////////////////////////////DRAW AND MOVE SUBARU (RED CAR) END //////////////////////////////////////////////////////////////////////CREATES OBSTACLES IN RANDOM LANES START void Obstacles() { //moves obstacle obstacleYPos += 5; //resets the obstacle if (obstacleYPos > 500) { obstacleYPos = -40; obstacleID = (int)random(0, 3); obstacleLane =(int)random(0, 3); //defines obstacle lane if (obstacleLane == 0) obstacleXPos = -120; if (obstacleLane == 1) obstacleXPos = 0; if (obstacleLane == 2) obstacleXPos = 120; } rectMode(CENTER); //pylon if (obstacleID == 0) { fill(pylonOrangeR, pylonOrangeG, pylonOrangeB); rect(200+obstacleXPos, 35+obstacleYPos, 30, 10); rect(200+obstacleXPos, 35+obstacleYPos, 10, 30); fill(pylonOrangeLightR, pylonOrangeLightG, pylonOrangeLightB); rect(200+obstacleXPos, 35+obstacleYPos, 10, 10); } //pothole if (obstacleID == 1) { fill(potholedark); rect(200+obstacleXPos, 35+obstacleYPos, 40, 30); rect(200+obstacleXPos, 35+obstacleYPos, 60, 10); rect(200+obstacleXPos, 35+obstacleYPos, 10, 50); rect(200+obstacleXPos, 55+obstacleYPos, 10, 10); fill(pothole); rect(200+obstacleXPos, 40+obstacleYPos, 20, 20); rect(200+obstacleXPos, 35+obstacleYPos, 40, 10); rect(200+obstacleXPos, 25+obstacleYPos, 10, 10); } //road block if (obstacleID == 2) { fill(pylonOrangeR, pylonOrangeG, pylonOrangeB); rect(175+obstacleXPos, 25+obstacleYPos, 10, 30); rect(175+obstacleXPos, 25+obstacleYPos, 30, 10); rect(235+obstacleXPos, 25+obstacleYPos, 10, 30); rect(235+obstacleXPos, 25+obstacleYPos, 30, 10); fill(pylonOrangeLightR, pylonOrangeLightG, pylonOrangeLightB); rect(175+obstacleXPos, 25+obstacleYPos, 10, 10); rect(235+obstacleXPos, 25+obstacleYPos, 10, 10); fill(headLightsR, headLightsG, headLightsB); rect(205+obstacleXPos, 35+obstacleYPos, 50, 10); fill(jacketBlk); rect(195+obstacleXPos, 35+obstacleYPos, 10, 10); rect(215+obstacleXPos, 35+obstacleYPos, 10, 10); } } //////////////////////////////////////////////////////////////////////CREATES OBSTACLES IN RANDOM LANES END //////////////////////////////////////////////////////////////////////LANE DIVIDER ART AND MOVEMENT START void laneDivider() { fill(dividerR, dividerG, dividerB); rectMode(CENTER); //distance between each lane offset = -40; if (laneSpeed <40) laneSpeed+= 5; else laneSpeed = 0; //creates individual lanes while (offset <450) { rect(140, offset + laneSpeed, 10, 30); offset+=40; } //distance between each lane offset = -40; //creates individual lanes while (offset <450) { rect(260, offset + laneSpeed, 10, 30); offset+=40; } } //////////////////////////////////////////////////////////////////////LANE DIVIDER ART AND MOVEMENT END //////////////////////////////////////////////////////////////////////GAME OVER SCREEN START void gameOver() { background(223, 63, 110); rectMode(CORNERS); fill(creamColourR, creamColourG, creamColourB); //G rect(110, 90, 140, 100); rect(100, 100, 110, 150); rect(110, 150, 140, 160); rect(130, 130, 150, 140); rect(140, 140, 150, 150); //A rect(160,100,170,160); rect(170,90,190,100); rect(170,120,190,130); rect(190,100,200,160); //M rect(210,100,220,160); rect(220,90,230,100); rect(230,100,240,130); rect(240,90,250,100); rect(250,100,260,160); //E rect(270,90,280,160); rect(280,90,310,100); rect(280,120,300,130); rect(280,150,310,160); //////GAME //O rect(110,180,140,190); rect(100,190,110,240); rect(140,190,150,240); rect(110,240,140,250); //V rect(160,180,170,230); rect(170,230,180,240); rect(180,240,190,250); rect(190,230,200,240); rect(200,180,210,230); //E rect(220,180,230,250); rect(230,180,260,190); rect(230,210,250,220); rect(230,240,260,250); //R rect(270,180,280,250); rect(280,180,310,190); rect(300,190,310,220); rect(280,210,300,220); rect(290,220,300,230); rect(300,230,310,250); //////////////////////////////////////////////////////////////////////GAME OVER SCREEN END }