xxxxxxxxxx
Player frog = new Player();
ArrayList<Log> logList;
ArrayList<Log> logList1;
int state;
int baysFilled;
int score;
int sessionBest;
float logArrayL[] = {2, 4, 7, 9};
float logArrayR[] = {3, 6, 8};
void setup() {
size(700, 700);
background(0);
frog.setup();
logList = new ArrayList<Log>();
logList1 = new ArrayList<Log>();
}
void draw() {
if (state == 0) {
welcome();
} else if (state == 1) {
game();
} else if (state == 2) {
gameover();
} else if (state == -1){
instructions();
}
// check gameover
if (state == 1 && frog.gameover()) {
state = 2;
}
// Score
if(frog.inBay0()){
print("frog in bay0");
score++;
frog.posX = width/2;
frog.posY = height*0.95;
} else if (frog.inBay1()){
print("frog in bay1");
score++;
frog.posX = width/2;
frog.posY = height*0.95;
} else if (frog.inBay2()){
print("frog in bay2");
score++;
frog.posX = width/2;
frog.posY = height*0.95;
} else if (frog.inBay3()){
print("frog in bay3");
score++;
frog.posX = width/2;
frog.posY = height*0.95;
} else if (frog.inBay4()){
print("frog in bay4");
score++;
frog.posX = width/2;
frog.posY = height*0.95;
}
if (score > sessionBest){
sessionBest = score;
}
}
/*void score(){
if(frog.inBay0 || frog.inBay1 || frog.inBay2 || frog.inBay3 || frog.inBay4){
score++;
frog.posX = width/2;
frog.posY = height*0.95;
}
}*/
void keyPressed() {
frog.keyPressed();
//state mgmt.
if ((state == 0 || state == -1) && key == 'p') {
state = 1;
}
if(state == 2 && key == 'r'){
gameRestart();
state = 1;
}
if((state == 0 || state == 2) && key == 'i'){
state = -1;
}
}