Hello everyone! So my assigned project for this week is to make a microgame. For my game, i thought it would be fun if I did a "match the picture" sort of game. The basic premise is that a series of cat heads will appear, and you have to press the corresponding keyboard keys to match it. I need some help with two things:
1. I have a majority of the code down but I need a way to randomize the cat heads that are appearing in the top left corner of the screen. I also want them to stay on screen for a little bit longer.
2. I need to let the player know when they succeeded or failed to match the cat head. What "if" statement would you guys write in order to do that? I want it to say something like "FAIL" when they fail and "WIN" when they succeed.
I included all the images I use at the bottom of this post if anyone has the time to mess around with it. Thank you SO much for your time and any help! Here's my code:
PImage img;
1. I have a majority of the code down but I need a way to randomize the cat heads that are appearing in the top left corner of the screen. I also want them to stay on screen for a little bit longer.
2. I need to let the player know when they succeeded or failed to match the cat head. What "if" statement would you guys write in order to do that? I want it to say something like "FAIL" when they fail and "WIN" when they succeed.
I included all the images I use at the bottom of this post if anyone has the time to mess around with it. Thank you SO much for your time and any help! Here's my code:
PImage img;
PImage img2;
PImage img3;
PImage img4;
int i;
void setup()
{
size(800, 577);
frameRate(1000);
img = loadImage ("nyan.png");
img2 = loadImage ("kitty.png");
img3 = loadImage ("cat.png");
img4 = loadImage ("kitten.png");
int i = 1;
}
void draw() {
{
PImage img;
img = loadImage("space.jpg");
background(img);
}
{
{
{
if ( i == 1 )
{
i= i + 1;
image(img, 0, 0);
}
else if (i == 20)
{
i= i + 1;
image(img2, 0, 0);
}
else if (i == 40)
{
i= i + 1;
image(img3, 0, 0);
}
else if (i == 60)
{
i= i + 1;
image(img4, 0, 0);
}
else
{
i = i + 1;
if ( i == 80)
{
i = 1;
}
}
}
}
{
if (keyPressed) {
{
if (key=='x' || key =='X') {
image(img, 300, 200);
}
{
if (keyPressed) {
if (key=='c' || key =='C') {
image(img2, 300, 200);
}
{
if (keyPressed) {
{
if (key=='v' || key == 'V') {
image(img3, 300, 200);
}
if (keyPressed) {
if (key=='b' || key =='B') {
image (img4, 300, 200);
}
}
}
}
}
}
}
}
}
}
}
}
Here are my images
(cat.png)
(kitten.png)
(kitty.png)
(nyan.png)
(space.jpg)
Here are my images
(space.jpg)
1