Please help - Simple Game issues
in
Programming Questions
•
5 months ago
I am struggling phenomenally hard with making it possible to click on the bombs and make them disappear, if any one is able to do it I will be in debt to you forever. Please make my day and help me out, Il send you the data files needed to run if needed. Please and thanks..
Nazi r1;
PImage img;
PImage bg;
PImage CLDS;
import ddf.minim.*; //minim/ audio
import ddf.minim.signals.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
int INTRO = 0; // Start screen
int RUN_GAME = 1; //Game
int gameState = INTRO; //start
int numBombs = 12;
Nazi[] bombs = new Nazi[numBombs]; // Declare and create the array
Minim minim;
AudioPlayer song;
//----------------------------------------------------------------------------
void setup() {
size(600, 600);
smooth();
noStroke();
minim = new Minim(this);
song= minim.loadFile("Song1.mp3");
song.play();
song.loop();
img = loadImage("Untitled.png");
bg = loadImage("BG.jpg");
CLDS = loadImage("Clouds.png");
//Loop through array to create each object
for (int i = 0; i < bombs.length; i++) {
bombs[i] = new Nazi(); // Create each object
r1 = new Nazi();
}
}
//----------------------------------------------------------------------------//
void draw() {
if (gameState == INTRO) {
intro();
}
else if (gameState == RUN_GAME) {
run_game();
}
}
void intro() {
PImage z;
z = loadImage("http://i1086.photobucket.com/albums/j443/MrLukeyD/BGG_zps05ab82b9.jpg");
z.resize(600, 600);
// first image you see, start screen
background(z);
}
//-----------------------------------------------------------------------
void run_game() {
background(bg);
//Loop through array to use objects.
for (int i = 0; i < bombs.length; i++) {
bombs[i].fall();
}
}
class Nazi {
float x = random(600);
float y = random(-height);
boolean disabled=false;
void fall() {
y = y+6;
image(CLDS, 0, 0);
image(img, x, y);
if (y>height) {
x = random(600);
y = random(-200);
}
}
}
//-------------------------------------------------------------------------
//------------------------------------------------------------------------
void mousePressed() {
if ( gameState == INTRO) {
gameState = RUN_GAME; // start the game
}
}
1