//project 1 //Adam Kochen int score=0; int healthX=99; float horizon=150; float sunX=50,sunY=30; float demonLordX=random(500,800), demonLordY= 500; float heroX=random(0,300) ,heroY=random(300,500); float dayScore = 2; float treasureX= random(20,780), treasureY = random(200,600); float travelX = 0 , travelY = 0; int gMode = 1; String pName = " "; String gName = "The Sceptre of Hades"; void setup () { size(800,600); } void draw(){ //Next Frame if( gMode == 1) { play(); } else if( gMode == 2){ scene(); treasure(); sun(); demonLord(); hero(); score(); health(); } else{ //gEnd(); } } void play(){ noStroke(); background(255,153,0); fill(255,204,0); rect(width-750, height-550, width-100, height-100,40); fill(0); textSize(15); fill(255,0,0); //text(gMode,10,10); text(" Welcome to " + gName + ". You are the newest Demon Lord. Your father ",100,100); text("the previous Demon Lord was slain by the world's greatest hero. Fortunately though",100,118); text("before he died he was able to tell you about his plan to take over the world. He had",100,136); text("planned to use the Scepter of Hades to bring all the souls from the underworld back",100,154); text("to the overworld and use them as his undead army. Unfortunately the scepter was",100,172); text("destroyed during the war of gods hundreds of years ago and the pieces hidden away.",100,190); text("Your goal is to find all the pieces and complete your father's plan to take over the",100,208); text("world. You can use the shard detector in the upper left corner to help you find the",100,226); text("pieces. The detector will tell you how far away you are from the piece nearest to you",100,244); text("while avoiding the son of the hero that defeated your father who is currently hunting",100,262); text("you.",100,280); text(" So what are you waiting for? Click play already!",250,350); fill(204,0,0); rect(350,500,100,50,6); fill(0); textSize(35); text("play",370,535); if(mousePressed && mouseX < 451 && mouseX > 349 && mouseY < 551 && mouseY > 499) { gMode = 2; } if(key == 'q'){ gMode = 1;} } void scene(){ //sky textSize(11); noStroke(); if(dayScore%2==0) {background(0,200,255); } else{ background(0,0,123); }; fill(0,255,0); rect(0,horizon,800,500); //fill(0); text(score,20,700); text(gName,680,10); } void sun(){ //draw sun ellipseMode(CORNER); if(dayScore%2==0) {fill(255,210,0); }else{fill(220); }; noStroke(); ellipse(sunX,sunY,40,40); sunX= sunX +2; //reset sun if(sunX > width+10){ sunX=50; dayScore=dayScore + 1; } } void demonLord(){ //make demonLord fill(0); rect(demonLordX,demonLordY,40,80); ellipseMode(CORNER); ellipse(demonLordX,demonLordY-40,40,40); strokeWeight(10); stroke(183,0,0); //horns if(mouseX horizon || mouseY > horizon) {demonLordY= demonLordY+ (mouseY - demonLordY)/5;} demonLordX= demonLordX+ (mouseX - demonLordX)/5; //Name demonLord fill(255,0,255); text("Demon",demonLordX,demonLordY+40); text("Lord",demonLordX+8,demonLordY+53); } void hero(){ //chase demonLord heroX= heroX+ (demonLordX-heroX)/90; heroY= heroY+ (demonLordY-heroY)/90; //make hero sword strokeWeight(10); stroke(183,178,180); if(demonLordX>heroX) { line(heroX+10,heroY+15,heroX+90,heroY+15);//blade noStroke(); fill(0,100,200); rect(heroX,heroY+10,50,10); //handle rect(heroX+49,heroY,8,30); //hand guard } else { line(heroX,heroY+15,heroX-50,heroY+15); //blade noStroke(); fill(0,100,200); rect(heroX-10,heroY+10,50,10); //handle rect(heroX-17,heroY,8,30); //hand guard } //make hero rectMode(CORNER); fill(255); rect(heroX,heroY,40,80); //body ellipse(heroX,heroY-40,40,40); //head fill(200,50,200); //moving eye if(demonLordX