“FROG” by Nikolaj Andersen
https://openprocessing.org/sketch/975636
License CreativeCommons Attribution ShareAlike
https://creativecommons.org/licenses/by-sa/3.0
{{filePath}}
{{width}} x {{height}}
Report Sketch
Oh, that naughty sketch! Please let us know what the issue is below.
Apply Template
Applying this template will reset your sketch and remove all your changes. Are you sure you would like to continue?
Report Sketch
Report Comment
Please confirm that you would like to report the comment below.
We will review your submission and take any actions necessary per our Community Guidelines. In addition to reporting this comment, you can also block the user to prevent any future interactions.
Please report comments only when necessary. Unnecessary or abusive use of this tool may result in your own account being suspended.
Are you sure you want to delete your sketch?
Any files uploaded will be deleted as well.
Delete Comment?
This will also delete all the replies to this comment.
Delete this tab? Any code in it will be deleted as well.
Select a collection to submit your sketch
We Need Your Support
Since 2008, OpenProcessing has provided tools for creative coders to learn, create, and share over a million open source projects in a friendly environment.
Niche websites like ours need your continued support for future development and maintenance, while keeping it an ad-free platform that respects your data and privacy!
Please consider subscribing below to show your support with a "Plus" badge on your profile and get access to many other features!
keyboard
CC Attribution ShareAlike
FROG
Andersen
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;
}
}
See More Shortcuts