Would like help with an "if" statement/TEXT
in
Programming Questions
•
1 year ago
There is my code! The object of the game is to fill the screen with as many cat heads as possible before the timer hits zero. I want help writing a statement so that if lets say the player generates 40 cat heads, text shows up and says something like "YOU WIN!" and if they fail to get to 40, it comes up as you "YOU LOSE"
you get the basic idea :) Let me know if I can provide you with any more information. Thanks for your time!
PFont font;
you get the basic idea :) Let me know if I can provide you with any more information. Thanks for your time!
PFont font;
int time=0;
PImage img;
PImage img1;
PImage img2;
PImage img3;
PImage img4;
int timer=11;
int timeLast = 0;
void setup()
{
size(800, 577);
frameRate(20);
img = loadImage ("space.jpg");
img1 = loadImage ("nyan.png");
img2 = loadImage ("kitty.png");
img3 = loadImage ("cat.png");
img4 = loadImage ("kitten.png");
timeLast=second();
font = loadFont("ForteMT-48.vlw");
textFont(font, 50);
background(img);
}
void draw() {
fill(0);
ellipse(590, 290, 80, 80);
fill(255);
if (timer>0) {
game();
}
}
void game() {
if (second()!=timeLast)
{
timeLast=second();
img=loadImage("space.jpg");
timer-=1;
}
{
text("TiME LEFT 4 CATZ: "+timer, 150, 300);
}
if (keyPressed==true) {
{
if (key=='x' || key =='X') {
image(img1, random(800), random(577));
}
{
if (keyPressed==true) {
if (key=='c' || key =='C') {
image(img2, random(800), random(577));
}
{
if (keyPressed) {
{
if (key=='v' || key == 'V') {
image(img3, random(800), random(577));
}
if (keyPressed) {
if (key=='b' || key =='B') {
image(img4, random(800), random(577));
}
}
}
}
}
}
}
}
}
}
1