//Jenna Klima // COPY 1015c /**\\NEED HELP WITH// main things: make buttons work and make a pause screen (1) draw ground over sun/moon (2) draw news over sun/moon (3) how to show positions of everything? This will be for debug via "D" key (4) make HP so it doesn't blink when it goes over full (5) keep Skelly and Riburt inside the play //Jenna Klima // COPY 1015c /**\\NEED HELP WITH// main things: make buttons work and make a pause screen (1) draw ground over sun/moon (2) draw news over sun/moon (3) how to show positions of everything? This will be for debug via "D" key (4) make HP so it doesn't blink when it goes over full (5) keep Skelly and Riburt inside the play screen (6) make buttons take player to already coded playscreens (7) make a pause screen for playing the game (8) make the game recognize the mouse out of the playing screen #8 can be done by URL=suffolk.li,1st link,Kotchen,outmouse**/ // //making variables //floats float horizon; float sunX = 50, sunY = 30; float riburtX = random ( 500, 800 ), riburtY = 500; float skellyX = random ( 0, 300 ), skellyY = random ( 300, 500 ); float setDaycycle = 2; float bugX = random ( 20, 780 ), bugY = random ( 200, 600 ); //for float either return one or the other randomly float either ( float here, float there ) { return random ( 0, 1 ) < 0.5 ? here : there; } //-- float result; //-- if ( random ( 1 ) < 0.5 ) result = here; //-- else result = there; //-- return result; //-- } //integers int playScreen = 1; int score = 0; int hpX = 200; int contrast = 75; //strings String title = "Riburt & Skelly"; String author = "Jenna Klima"; String news = ""; //and a boolean boolean day = true; void setup ( ) { size ( 1000, 600 ); horizon = height / 4; sunY = horizon / 2; reset ( ); } void reset ( ) { // // //move characters to their original places // //moves bug to random location on game screen //-- bugX = random ( width ); //-- bugY = random ( horizon, height ); bugX = random ( width / 4, width * 3 / 4 ); bugY = random ( horizon + 20, height - 20 ); //-- // //resets Riburt and Skelly anywhere on the game screen //-- riburtX=width/2; //-- riburtY=height/2; //-- skellyX=30; //-- skellyY=random(horizon, height-60); // //Riburt resets left and Skelly resets right riburtX = width - 30; skellyX = 30; // //Riburt resets@topLeft/bottomLeft&Skelly=same but rightbound //-- riburtY = random ( 0, 1 ) < 0.5 ? here : there; //-- skellyY = random ( 0, 1 ) < 0.5 ? here : there; //-- riburtY = random ( horizon, height - 60 ); //-- skellyY = random ( horizon, height - 60 ); riburtY = either ( horizon + 50, height - 50 ); skellyY = either ( horizon + 70, height - 70 ); mouseY = height; } void draw ( ) { //next frame if ( playScreen == 1 ) { startPage ( ); } else if ( playScreen == 2 ) { storyPage ( ); } else if ( playScreen == 3 ) { rulesPage ( ); } else if ( playScreen == 4 ) { scene ( ); sun ( ); hp ( ); score ( ); bug ( ); monster ( ); hero ( ); } else if ( playScreen == 5 ) { youLostPage ( ); } //-- else if ( playScreen == 6 ) { //-- youWonPage ( ); //-- } //-- else if ( playScreen == 7 ) { //-- creditsPage ( ); //-- } else { background ( 255, 0, 0 ); } } void startPage ( ) { //screen color for this screen only background ( 50 ); //title textSize ( 50 ); fill ( 255 ); text ( "Riburt & Skelly", 325, 75 ); //STORY fill ( 255, 255, 0 ); rect ( 420, 165, 150, 50, 60 ); textSize ( 30 ); fill ( 20 ); text ( "STORY", 450, 200 ); //the STORY button functionality and dimentions if ( mousePressed && mouseX < 165 && mouseX > 420 && mouseY < 325 && mouseY > 165 ) { playScreen = 2; } //RULES fill ( 255, 255, 0 ); rect ( 420, 265, 150, 50, 60 ); textSize ( 30 ); fill ( 20 ); text ( "RULES", 450, 300 ); //the RULES button functionality and dimentions if ( mousePressed && mouseX < 265 && mouseX > 420 && mouseY < 325 && mouseY > 265 ) { playScreen = 3; } fill ( 255, 0, 0 ); //-- rect ( 350, 500, 150, 50, 60 ); float buttonX = 350, buttonY = 500, buttonW = 150, buttonH = 60; /* rect ( buttonX, buttonY, buttonW, buttonH, 60 ); textSize ( 35 ); fill ( 0 ); //-- text ( "START", 370, 535 ); text ( "START", buttonX+20, buttonY + 35 ); */ makeButton ( "START", 350, 500, 150, 60 ); //the START button functionality and dimentions //-- if ( mousePressed && mouseX<500 && mouseX>350 && mouseY<550 && mouseY>500 ) if ( buttonClicked ( 350, 500, 150, 60 ) ) { playScreen = 4; } /* if ( mousePressed && mouseX>buttonX && mouseXbuttonY && mouseY 350 && mouseY < 550 && mouseY > 500 ) { playScreen = 1; } } void makeButton ( String s, float buttonX, float buttonY, float buttonW, float buttonH ) { //make a button rect ( buttonX, buttonY, buttonW, buttonH, 60 ); textSize ( 35 ); fill ( 0 ); //-- text ( "START", 370, 535 ); text ( s, buttonX + 20, buttonY + 35 ); } boolean buttonClicked ( float buttonX, float buttonY, float buttonW, float buttonH ) { //return true iff this button was clicked if ( mousePressed && mouseX>buttonX && mouseXbuttonY && mouseY 350 && mouseY < 550 && mouseY > 500 ) { playScreen = 1; } } void youLostPage ( ) { background ( 50 ); textSize ( 50 ); fill ( 255 ); text ( "YOU LOST!", 360, 75 ); fill ( 255 ); rect ( 500, 290, 150, 50, 60 ); textSize ( 35 ); fill ( 0 ); text ( "RETRY", 450, 300 ); //the RETRY button functionality and dimentions if ( mousePressed && mouseX < 265 && mouseX > 420 && mouseY < 325 && mouseY > 265 ) { playScreen = 4; } fill ( 255, 0, 0 ); rect ( 415, 525, 150, 50, 60 ); textSize ( 35 ); fill ( 0 ); text ( "TITLE", 370, 535 ); //the TITLE button functionality and dimentions if ( mousePressed && mouseX < 500 && mouseX > 350 && mouseY < 550 && mouseY > 500 ) { playScreen = 1; } } void score ( ) { // //show white score in night and darker gray at day //score,HP,nametag1,nametag2 R completely independent of each other if ( setDaycycle %2 == 0 ) { fill ( 75 ); contrast = 75; } //-- text ( "Score:" + score, 475, 15 ); else { fill ( 255 ); contrast = 255; } //-- text ( "Score:" + score, 475, 15 ); text ( "Score:" + score, 475, 15 ); if ( dist ( riburtX, riburtY, skellyX, skellyY ) <100 ) { capture ( ); } } void scene ( ) { //all text from here on will be size 16 textSize ( 16 ); //sky color and dimentions at day if ( setDaycycle %2 == 0 ) { background ( 150, 150, 250 ); //ground color and dimentions at day rectMode ( CORNER ); noStroke ( ); fill ( 50, 200, 50 ); rect ( 0, horizon, width, height * 3 / 4 ); } //sky color and dimentions at night else { background ( 60, 60, 120 ); rectMode ( CORNER ); noStroke ( ); fill ( 50, 100, 50 ); rect ( 0, horizon, width, height * 3 / 4 ); } //color and dimentions of news if ( setDaycycle %2 == 0 ) { fill ( 75 ); contrast = 75; } else { fill ( 255 ); contrast = 255; } text ( news, 490, 40 ); } void sun ( ) { //draw sun OR moon if ( setDaycycle %2 == 0 ) { fill ( 255, 255, 85 ); //sun rays stroke ( 255, 255, 0 ); line ( sunX + 40, sunY + 40, sunX + 18, sunY + 18 ); line ( sunX - 40, sunY - 40, sunX - 18, sunY - 18 ); line ( sunX + 40, sunY - 40, sunX + 18, sunY - 18 ); line ( sunX - 40, sunY + 40, sunX - 18, sunY + 18 ); line ( sunX, sunY + 25, sunX, sunY + 55 ); line ( sunX, sunY - 25, sunX, sunY - 55 ); line ( sunX + 25, sunY, sunX + 55, sunY ); line ( sunX - 25, sunY, sunX - 55, sunY ); } else { fill ( 220 ); } noStroke ( ); ellipse ( sunX - 24, sunY - 24, 50, 50 ); sunX = sunX + 2; //reset sun AND moon (works with both) if ( sunX > width + 10 ) { sunX = 0; sunY = random ( 30, horizon - 30 ); setDaycycle = setDaycycle + 1; } } void hp ( ) { // //draw HP bar //keeps HP from going over 200 if ( hpX > 200 ) { hpX = 200; } //the HP in the bar noStroke(); if ( setDaycycle %2 == 0 ) { fill ( 255, 0, 0 ); } else { fill(200,0,0); } rect(15,22,hpX,10); //the HP bar stroke ( 0 ); noFill ( ); rect ( 15, 22, 200, 10 ); //the text "HP" if ( setDaycycle %2 == 0 ) { fill ( 75 ); contrast = 75; } else { fill ( 255 ); contrast = 255; } text ( "HP", 5, 15 ); //for some reason the line directly below doesn't work //--hpX = hpX < 201; ///////////////starvation factor (doesn't work past width/1000 for some reason) //-- if ( hpX <= 200 ) { //-- hpX = hpX - width / 100; //-- } if ( hpX == 0 ) { playScreen = 5; } /* //makes game red when HP=0 if ( playScreen == 5 ) { noStroke ( ); fill ( 255, 0, 0 ); rect ( 0, 0, 1000, 600 ); } */ } void hero ( ) { //hero: Riburt follows x then y coords of mouse location riburtX = riburtX + ( mouseX - riburtX ) / 30; riburtY = riburtY + ( mouseY - riburtY ) / 30; //prevents hero: Riburt from leaving ground if ( riburtY < horizon ) { riburtY = horizon; } // //collect bug if hero: riburt touches it //bug starts in a random location after collected if ( dist ( bugX, bugY, riburtX, riburtY ) < 75 ) { score += 200; bugX = random ( 50, width - 50 ); bugY = random ( horizon, height - 50 ); hpX = hpX + 10; //if bug is collected, "HP+5" is displayed news = "HP+5"; } //hero: Riburt's green, black-outlined head dimensions ellipseMode ( CENTER ); stroke ( 0 ); if ( setDaycycle %2 == 0 ) { fill ( 0, 255, 0 ); } else { fill ( 0, 200, 0 ); } ellipse ( riburtX, riburtY - 75 + 40, 75, 75 ); //hero: Riburt's white,blk-outlined eye 1: white of eye dimensions ellipseMode ( CORNER ); fill ( 255 ); ellipse ( riburtX - 30, riburtY - 130 + 40, 20, 20 ); //hero: Riburt's black, black-outlined eye 1: pupil dimensions ellipseMode ( CORNER ); fill ( 0 ); ellipse ( riburtX - 20, riburtY - 125 + 40, 10, 10 ); //hero: Riburt's white,blk-outline eye 2: white of eye dimensions ellipseMode ( CORNER ); fill ( 255 ); ellipse ( riburtX + 10, riburtY - 130 + 40, 20, 20 ); //hero: Riburt's black, black-outlined eye 2: pupil dimensions ellipseMode ( CORNER ); fill ( 0 ); ellipse ( riburtX + 10, riburtY - 125 + 40, 10, 10 ); //hero: Riburt's green, black-outlined foot 1 dimensions ellipseMode ( CORNER ); if ( setDaycycle %2 == 0 ) { fill ( 0, 255, 0 ); } else { fill ( 0, 200, 0 ); } ellipse ( riburtX, riburtY, 50, 10 ); //hero: Riburt's green, black-outlined foot 2 dimensions ellipseMode ( CORNER ); if ( setDaycycle %2 == 0 ) { fill ( 0, 255, 0 ); } else { fill ( 0, 200, 0 ); } ellipse ( riburtX - 50, riburtY, 50, 10 ); //hero: Riburt's smile noFill ( ); arc ( riburtX - 35, riburtY - 110 + 40, 70, 50, 0, PI ); //hero: Riburt's nametag //-- fill ( 0 ); //-- fill ( setDaycycle %2 == 0 ? 75 : 100 ); //(same as directly above meaning excluding "fill ( 0 );" and earlier) fill ( contrast ); //name and dimentions of nametag text ( "Riburt", riburtX - 25, riburtY - 100 ); //riburt follows mouse riburtX = riburtX + ( mouseX - riburtX ) / 30; riburtY = riburtY + ( mouseY - riburtY ) / 30; } void monster ( ) { //chase riburt skellyX = skellyX + ( riburtX - skellyX ) / 150; skellyY = skellyY + ( riburtY - skellyY ) / 150; //monster: Skelly's shoulder your left dimensions rectMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX - 30, skellyY - 30, 80, 25, 7 ); //monster: Skelly's shoulder your right dimensions rectMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX + 30, skellyY - 30, 80, 25, 7 ); //monster: Skelly's arms face hero: Riburt if ( riburtX > skellyX ) { rectMode ( CORNERS ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX + 35, skellyY - 40, skellyX + 140, skellyY - 23 ); rect ( skellyX + 100, skellyY - 37, skellyX - 50, skellyY - 20 ); } else { rectMode ( CORNERS ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX - 35, skellyY - 40, skellyX - 140, skellyY - 23 ); rect ( skellyX - 100, skellyY - 37, skellyX + 50, skellyY - 20 ); } //monster: Skelly's spine rectMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX, skellyY, 20, 100 ); //monster: Skelly's ribcage rib 1 rectMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX, skellyY - 5, 50, 10 ); //monster: Skelly's ribcage rib 2 rectMode(CENTER); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX, skellyY + 10, 65, 10 ); //monster: Skelly's ribcage rib 3 rectMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX, skellyY + 25, 55, 10 ); //--//monster: Skelly's black, black-outlined arm 1 your left dimensions //-- rectMode ( CORNERS ); //-- if ( setDaycycle %2 == 0 ) { //-- fill ( 75 ); //-- } //-- else { //-- fill ( 50 ); //-- } //-- rect ( skellyX - 65, skellyY - 35, skellyX - 45, skellyY + 50 ); //--//monster: Skelly's black, black-outlined arm 2 your right dimensions //-- if ( setDaycycle %2 == 0 ) { //-- fill ( 75 ); //-- } //-- else { //-- fill ( 50 ); //-- } //-- rect ( skellyX + 65, skellyY - 35, skellyX + 45, skellyY + 50 ); //monster: Skelly's black, black-outlined, head dimensions ellipseMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } ellipse ( skellyX, skellyY - 40, 50, 60 ); //monster: Skelly's blue, black-outlined leg 1 dimensions rectMode(CENTER); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX - 20, skellyY + 100, 20, 100 ); //monster: Skelly's blue, black-outlined leg 2 dimensions rectMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX + 20, skellyY + 100, 20, 100 ); //monster: Skelly's blue, blue-outlined butt dimensions rectMode ( CENTER ); if ( setDaycycle %2 == 0 ) { fill ( 75 ); } else { fill ( 50 ); } rect ( skellyX, skellyY + 50, 80, 20 ); //monster: Skelly's nametag //old code directly below meaning excluding "fill(setDaycycle%2==0?100:255);" and after //-- fill ( 0 ); //-- fill ( setDaycycle %2 == 0 ? 100 : 255 ); //(same as directly above meaning excluding "fill ( 0 );" and earlier) fill ( contrast ); //name and dimentions of nametag text ( "Skelly", skellyX - 20, skellyY - 80); } void capture ( ) { hpX = hpX - 10; //-- skellyX = random ( 0, 750 ); //-- skellyY = random ( 250, 550 ); score = score - 200; background ( 255, 0, 0 ); bugX = random ( width / 4, width * 3 / 4 ); bugY = random ( horizon + 20, height - 20 ); riburtX = width - 30; riburtY = random ( horizon, height - 60 ); skellyX = 30; skellyY = random ( horizon, height - 60 ); mouseY = height; } void bug ( ) { //body if ( setDaycycle %2 == 0 ) { fill ( 200, 0, 0 ); } else { fill ( 150, 0, 0 ); } ellipse ( bugX, bugY, 50, 30 ); //front leg if ( setDaycycle %2 == 0 ) { fill ( 30 ); } else { fill ( 20 ); } fill ( setDaycycle % 2 == 0 ? 30 : 20 ); rect ( bugX + 10, bugY + 15, 5, 15 ); //middle leg if ( setDaycycle %2 == 0 ) { fill ( 30 ); } else { fill ( 20 ); } rect ( bugX + 25, bugY + 17, 5, 15 ); //back leg if ( setDaycycle %2 == 0 ) { fill ( 30 ); } else { fill ( 20 ); } rect ( bugX + 40, bugY + 15, 5, 15 ); //head if ( setDaycycle %2 == 0 ) { fill ( 200, 0, 0); } else { fill ( 150, 0, 0 ); } ellipse ( bugX - 5, bugY, 30, 20 ); } void mousePressed ( ) { riburtX = mouseX; riburtY = mouseY; } void keyPressed() { //handle keys if (key == 'q') exit(); } /** //GOALS// make START, STORY, RULES, YOU LOST, YOU WON, and CREDITS pages when player gets 10000 or more points display YOU WON page make news for whatever happens when: frog escapes, skelly is crushed frog burned, skelly is crushed frog captured, skelly gets away from the dragons with it make a key cheat "C" to see credits at any time ingame make "D" key pressed for showing position of everything 4 debug make Skelly drop a scroll upon start and reset make frog ecosystem //ANIMATIONS// make GRASS BLOWING, DRAGONS FLYING, and LEAVES BLOWING frames if fire hits Riburt make the game reset make fire mimic gravity make fire burn on random location of ground then dissappear //REMINDERS FOR THE CREDITS PAGE// Adam Kochen (Kochen outmouse) For allowing the use of some of his code Mike Schuler For showing me how to publish sketches with openprocessing.org Brian _? Doscher? For making the little big suff possible Courtney Blanco president of computer club helped me with _?**/screen (6) make buttons take player to already coded playscreens (7) make a pause screen for playing the game (8) make the game recognize the mouse out of the playing screen #8 can be done by URL=suffolk.li,1st link,Kotchen,outmouse**/ // //making variables //floats float horizon; float sunX=50,sunY=30; float riburtX=random(500,800),riburtY=500; float skellyX=random(0,300),skellyY=random(300,500); float setDaycycle=2; float bugX=random(20,780),bugY=random(200,600); //for float either return one or the other randomly float either(float here,float there){ return random(0,1)<0.5?here:there;} //-- float result; //-- if (random(1) < 0.5 ) result= here; //-- else result= there; //-- return result;} //integers int playScreen=1; int score=0; int hpX=200; int contrast=75; //strings String title="Riburt & Skelly"; String author="Jenna Klima"; String news=""; //and a boolean boolean day=true; void setup(){ size(1000,600); horizon=height/4; sunY=horizon/2; reset(); } void reset(){ // // //move characters to their original places // //moves bug to random location on game screen //-- bugX=random(width); //-- bugY=random(horizon,height); bugX=random(width/4,width*3/4); bugY=random(horizon+20,height-20); //-- // //resets Riburt and Skelly anywhere on the game screen //-- riburtX=width/2; //-- riburtY=height/2; //-- skellyX=30; //-- skellyY=random(horizon, height-60); // //Riburt resets left and Skelly resets right riburtX=width-30; skellyX=30; // //Riburt resets@topLeft/bottomLeft&Skelly=same but rightbound //-- riburtY=random(0,1)<0.5?here:there; //-- skellyYrandom(0,1)<0.5?here:there; //-- riburtY=random(horizon,height-60); //-- skellyY=random(horizon,height-60); riburtY=either(horizon+50,height-50); skellyY=either(horizon+70,height-70); mouseY=height; } void draw(){ //next frame if(playScreen==1){startPage();} else if(playScreen==2){storyPage();} else if(playScreen==3){rulesPage();} else if(playScreen==4){ scene(); sun(); hp(); score(); bug(); monster(); hero();} else if(playScreen==5){youLostPage();} //-- else if(playScreen==6){youWonPage();} //-- else if(playScreen==7){creditsPage();} else{background(255,0,0);}} void startPage(){ //screen color for this screen only background(50); //Title textSize(50); fill(255); text("Riburt & Skelly",325,75); //STORY fill(255,255,0); rect(420,165,150,50,60); textSize(30); fill(20); text("STORY",450,200); //the STORY button functionality and dimentions if(mousePressed && mouseX<165 && mouseX>420 && mouseY<325 && mouseY>165) {playScreen=2;} //RULES fill(255,255,0); rect(420,265,150,50,60); textSize(30); fill(20); text("RULES",450,300); //the RULES button functionality and dimentions if(mousePressed&&mouseX<265&&mouseX>420&&mouseY<325&&mouseY>265) {playScreen=3;} fill(255,0,0); //-- rect(350,500, 150,50, 60); float buttonX=350, buttonY=500, buttonW=150, buttonH=60; /* rect( buttonX, buttonY, buttonW, buttonH, 60 ); textSize(35); fill(0); //-- text("START",370,535); text("START", buttonX+20, buttonY+35); */ makeButton( "START", 350,500, 150,60 ); //the START button functionality and dimentions //-- if(mousePressed && mouseX<500 && mouseX>350 && mouseY<550 && mouseY>500) if ( buttonClicked( 350,500, 150,60 ) ) playScreen=4; /* if( mousePressed && mouseX>buttonX && mouseXbuttonY && mouseY350&&mouseY<550&&mouseY>500) { playScreen=1; } } void makeButton( String s, float buttonX, float buttonY, float buttonW, float buttonH ) { // Make a button // rect( buttonX, buttonY, buttonW, buttonH, 60 ); textSize(35); fill(0); //-- text("START",370,535); text( s, buttonX+20, buttonY+35); } boolean buttonClicked( float buttonX, float buttonY, float buttonW, float buttonH ) { // Return true iff this button was clicked. // if( mousePressed && mouseX>buttonX && mouseXbuttonY && mouseY350&&mouseY<550&&mouseY>500) {playScreen=1;}} void youLostPage(){ background(50); textSize(50); fill(255); text("YOU LOST!",360,75); fill(255); rect(500,290,150,50,60); textSize(35); fill(0); text("RETRY",450,300); //the RETRY button functionality and dimentions if(mousePressed&&mouseX<265&&mouseX>420&&mouseY<325&&mouseY>265) {playScreen=4;} fill(255,0,0); rect(415,525,150,50,60); textSize(35); fill(0); text("TITLE",370,535); //the TITLE button functionality and dimentions if(mousePressed&&mouseX<500&&mouseX>350&&mouseY<550&&mouseY>500) {playScreen=1;}} void score(){ // //show white score in night and darker gray at day //score,HP,nametag1,nametag2 R completely independent of each other if(setDaycycle%2==0){ fill(75); contrast=75;} //-- text("Score:"+score,475,15); else{ fill(255); contrast=255;} //-- text("Score:"+score,475,15); text("Score:"+score,475,15); if(dist(riburtX,riburtY,skellyX,skellyY)<100){capture();}} void scene(){ //all text from here on will be size 16 textSize(16); //sky color and dimentions at day if(setDaycycle%2==0){ background(150,150,250); //ground color and dimentions at day rectMode(CORNER); noStroke(); fill(50,200,50); rect(0,horizon,width,height*3/4); //sky color and dimentions at night }else{ background(60,60,120); rectMode(CORNER); noStroke(); fill(50,100,50); rect(0,horizon,width,height*3/4); } //color and dimentions of news if(setDaycycle%2==0){ fill(75); contrast=75;} else{ fill(255); contrast=255;} text(news,490,40); } void sun(){ //draw sun OR moon if(setDaycycle%2==0){ fill(255,255,85); //sun rays stroke(255,255,0); line(sunX+40,sunY+40,sunX+18,sunY+18); line(sunX-40,sunY-40,sunX-18,sunY-18); line(sunX+40,sunY-40,sunX+18,sunY-18); line(sunX-40,sunY+40,sunX-18,sunY+18); line(sunX,sunY+25,sunX,sunY+55); line(sunX,sunY-25,sunX,sunY-55); line(sunX+25,sunY,sunX+55,sunY); line(sunX-25,sunY,sunX-55,sunY);} else{fill(220);} noStroke(); ellipse(sunX-24,sunY-24,50,50); sunX=sunX+2; //reset sun AND moon (works with both) if(sunX>width+10){ sunX=0; sunY=random(30,horizon-30); setDaycycle=setDaycycle+1;}} void hp(){ // //draw HP bar //keeps HP from going over 200 if(hpX>200){ hpX=200; } //the HP in the bar noStroke(); if(setDaycycle%2==0){ fill(255,0,0);} else{ fill(200,0,0);} rect(15,22,hpX,10); //the HP bar stroke(0); noFill(); rect(15,22,200,10); //the text "HP" if(setDaycycle%2==0){ fill(75); contrast=75;} else{ fill(255); contrast=255;} text("HP",5,15); //for some reason the line directly below doesn't work //--hpX=hpX<101; ///////////////starvation factor (doesn't work past width/1000 for some reason) //-- if(hpX<=200){ //-- hpX=hpX-width/100;} if(hpX==0){playScreen=5;} /*//makes game red when HP=0 if(playScreen==5){ noStroke(); fill(255,0,0); rect(0,0,1000,600); }*/ } void hero(){ //hero: Riburt follows x then y coords of mouse location riburtX=riburtX+(mouseX-riburtX)/30; riburtY=riburtY+(mouseY-riburtY)/30; //prevents hero: Riburt from leaving ground if(riburtYskellyX){ rectMode(CORNERS); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX+35,skellyY-40,skellyX+140,skellyY-23); rect(skellyX+100,skellyY-37,skellyX-50,skellyY-20);} else{ rectMode(CORNERS); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX-35,skellyY-40,skellyX-140,skellyY-23); rect(skellyX-100,skellyY-37,skellyX+50,skellyY-20);} //monster: Skelly's spine rectMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX,skellyY,20,100); //monster: Skelly's ribcage rib 1 rectMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX,skellyY-5,50,10); //monster: Skelly's ribcage rib 2 rectMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX,skellyY+10,65,10); //monster: Skelly's ribcage rib 3 rectMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX,skellyY+25,55,10); //--//monster: Skelly's black, black-outlined arm 1 your left dimensions //-- rectMode(CORNERS); //-- if(setDaycycle%2==0){ //-- fill(75);} //-- else{ //-- fill(50);} //-- rect(skellyX-65,skellyY-35,skellyX-45,skellyY+50); //--//monster: Skelly's black, black-outlined arm 2 your right dimensions //-- if(setDaycycle%2==0){ //-- fill(75);} //-- else{ //-- fill(50);} //-- rect(skellyX+65,skellyY-35,skellyX+45,skellyY+50); //monster: Skelly's black, black-outlined, head dimensions ellipseMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} ellipse(skellyX,skellyY-40,50,60); //monster: Skelly's blue, black-outlined leg 1 dimensions rectMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX-20,skellyY+100,20,100); //monster: Skelly's blue, black-outlined leg 2 dimensions rectMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX+20,skellyY+100,20,100); //monster: Skelly's blue, blue-outlined butt dimensions rectMode(CENTER); if(setDaycycle%2==0){ fill(75);} else{ fill(50);} rect(skellyX,skellyY+50,80,20); //monster: Skelly's nametag //old code directly below meaning excluding "fill(setDaycycle%2==0?100:255);" and after //-- fill(0); //-- fill(setDaycycle%2==0?100:255); //(same as directly above meaning excluding "fill(0);" and earlier) fill(contrast); //name and dimentions of nametag text("Skelly",skellyX-20,skellyY-80);} void capture(){ hpX=hpX-10; //-- skellyX=random(0,750); //-- skellyY=random(250,550); score=score-200; background(255,0,0); bugX=random(width/4,width*3/4); bugY=random(horizon+20,height-20); riburtX=width-30; riburtY=random(horizon,height-60); skellyX=30; skellyY=random(horizon,height-60); mouseY=height; } void bug(){ //body if(setDaycycle%2==0){ fill(200,0,0);} else{ fill(150,0,0);} ellipse(bugX,bugY,50,30); //front leg if(setDaycycle%2==0){ fill(30);} else{ fill(20); } fill( setDaycycle%2==0 ? 30 : 20 ); rect(bugX+10,bugY+15,5,15); //middle leg if(setDaycycle%2==0){ fill(30);} else{ fill(20);} rect(bugX+25,bugY+17,5,15); //back leg if(setDaycycle%2==0){ fill(30);} else{ fill(20);} rect(bugX+40,bugY+15,5,15); //head if(setDaycycle%2==0){ fill(200,0,0);} else{ fill(150,0,0);} ellipse(bugX-5,bugY,30,20); } void mousePressed(){ riburtX=mouseX; riburtY=mouseY; } void keyPressed() { // handle keys // if (key == 'q') exit(); } /** //GOALS// make START, STORY, RULES, YOU LOST, YOU WON, and CREDITS pages when player gets 10000 or more points display YOU WON page make news for whatever happens when: frog escapes, skelly is crushed frog burned, skelly is crushed frog captured, skelly gets away from the dragons with it make a key cheat "C" to see credits at any time ingame make "D" key pressed for showing position of everything 4 debug make Skelly drop a scroll upon start and reset make frog ecosystem //ANIMATIONS// make GRASS BLOWING, DRAGONS FLYING, and LEAVES BLOWING frames if fire hits Riburt make the game reset make fire mimic gravity make fire burn on random location of ground then dissappear //REMINDERS FOR THE CREDITS PAGE// Adam Kochen (Kochen outmouse) For allowing the use of some of his code Mike Schuler For showing me how to publish sketches with openprocessing.org Brian _? Doscher? For making the little big suff possible Courtney Blanco president of computer club helped me with _?**/