Adventure Game.
//works for screen being 500 i think
//note this is a work in progress
// a zelda esque adventure type thing
final static int up = 1;
final static int right = 2;
final static int down = 4;
final static int left = 8;
int bushcol=color(50,160,20);
int landcol=color(255,197,130);//a orangeish brown
//following four variables work with health
//if the healthxdist becomes 0, there will be no more health on the health bar.
//this causes you to die.
//bummer.
int healthx=0;
int healthy=0;
int healthxdist=30;
int healthydist=10;
class Hero {
int hx;//hero x
int hy;//hero y
int hrad;//hero radius
Hero(){
hrad=10;
hx=0;
hy=0;
}
void setLocation(int temphx, int temphy){
hx=temphx;
hy=temphy;
}
void display(){
stroke(0,255,50);
fill(0,255,50);
ellipse(hx,hy,hrad*2,hrad*2);
}
}
class Area1{
int monster1x=0;//x of monster
int monster1y=250;//y of monster
int monsterspeed=7;
int monster_rad=25;//speed of monster
int monstercol=color(255,0,0);
int bush1x=100;//bush 1 x
int bush2x=400;//bush 2 x
int bush1y=100;//bush 1 y
int bush2y=400;//bush 2 y
int bushrad=50;//radius of square bush
int pitx=25;
int pity=475;
int pitrad=30;
void display(){
fill(bushcol);//fills bush with a dark green
rect(bush1x,bush1y,bushrad,bushrad);//creates bush numero uno
rect(bush2x,bush2y,bushrad,bushrad);//here comes bush number 2!
fill(monstercol);
ellipse(monster1x,monster1y,monster_rad*2,monster_rad*2);//a monster draws near...
background(landcol);
}
void move(){
monster1x=monster1x+monsterspeed;//moving the monster
if(monster_rad+monster1x>500||monster1x<0){
monsterspeed=-1*monsterspeed;//lets the monster go back and forth...
}
}
}
class Dungeon1{
int lightx=10;//x of mystical light
int lighty=475;//y of mystical light
int lightrad=32;//radius of mystical light
int lightcol=color(200,200,0);//color of mystical light(lello)
int dungeoncol=color(0);//color of dungeon floor=black
void display(){
stroke(lightcol);
fill(lightcol);
ellipse(lightx,lighty,lightrad,lightrad);
background(dungeoncol);
}
}
class Mainmenu{
String txt1;//first string in menu
String txt2;//second string in menu
String txt3;//third string in menu
String txt4;// fourth string in menu
void mainmenu(){
txt1=("welcome to the Adventure");
txt2=("controlls are j,k,i,and l to move");
txt3=("you can shoot your gun with Q");
txt4=("to start your noble quest, press 'b'");
}
void display(){//this displays the main menu
text(txt1,100,100);
text(txt2,100,200);
text(txt3,100,300);
text(txt4,100,400);
}
}
size(500,500);
Mainmenu mainmenu;
mainmenu= new Mainmenu();
mainmenu.display();
}