//project 3 //Adam Kochen int textX = 10; int gMode = 1; int score=0; int healthX = 100; 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; float bodyW = 40 , bodyH =80; int n; //# of bird pairs float x, y; //position float w , h; //bird size float birdXA =100 , birdYA=100; float birdX,birdM=1; float z = 1; float mX = 44 , mY = 530; String pName = " "; String gName = "The Sceptre of Hades"; String adam = "Adam Kochen"; void setup () { size(800,600); } void draw(){ //Next Frame /* if( gMode == 1) {//start screen play(); } else if( gMode == 2){//play*/ scene(); monkey(10,0,9); //health(); treasure(); sun(); demonLord(); score(); hero(); grass(); x = 20; y = 50; w= 20; h= 15; fill(0); flock(n,birdX,y,w,h,birdM); birdX=birdX+birdM*5; //moves bird if(birdX > width+30*n || birdX < 0-30*n){//bounces bird birdReset(); birdM = -birdM;//swaps bird pos } /* else if(gMode == 3){ //game over }*/ } 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); fill(255,0,0); button(1,451,349,551,499,370,535,"Play"); } 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 treasure(){ //draw treasure fill(255,0,0,0); rect(treasureX,treasureY,10,10); //treasure found if(dist(demonLordX,demonLordY,treasureX,treasureY)<60){ treasureX= random(20,780); treasureY = random(200,580); score= score + 20; background(255); } //draw coorinates travelX= dist(demonLordX,demonLordY,treasureX,treasureY); fill(100); text(travelX,20,43); } 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); body(demonLordX,demonLordY,bodyW,bodyH); ellipseMode(CORNER); 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); body(heroX,heroY,bodyW,bodyH); //body //--ellipse(heroX,heroY-40,40,40); //head fill(200,50,200); //moving eye if(demonLordX w && mouseY < y && mouseY > h) { if(bMode==1) { gMode = 2; } //else if(bMode==2){ } rect(x,y,w-x,h-y,15); fill(0); text(text,tx,ty); } void monkey(float x, float y, float size){ //ladder fill(139,80,14); rect(x,y,size,800); rect(x+60,y,size,800); for(float r = 30;r