I had sought the answer from everywhere but there was not the solution at all and it makes me upset. Even thought I tried my friend's phone but it still stops working when I tried to run the game. Could someone please help get me out of this?
PFont bitoem; PImage birdImg, bgImg, obsImg, menuImg, startBtn; int score = 0, highScore = 0, genestate = 1, x = -200, y, vy = 0, wx[] = new int[2], wy[] = new int[2]; import ddf.minim.*;
AudioPlayer playerBGM, playerSwing, playerDie, playerScore; Minim minim;
void setup() {
fullScreen(P2D);
//size(600 , 800);
//game images
birdImg = loadImage("chosenBird_8Bit.png");
bgImg = loadImage("background_color002(1680x800).jpg");
obsImg = loadImage("obstacle_long.jpg");
menuImg = loadImage("startMenu.jpg");
startBtn = loadImage("startBtn.jpg");
bitoem = loadFont("8BITWONDERNominal-48.vlw");
//music & sfx minim = new Minim(this); playerBGM = minim.loadFile("Jextor.mp3", 128); playerBGM.play(); playerBGM.setGain(-10.0); playerBGM.loop();
playerSwing = minim.loadFile("sfx_wing.wav", 705);
playerScore = minim.loadFile("sfx_point.wav");
playerDie = minim.loadFile("sfx_hit.wav");
//fonts style textFont(bitoem, 24); fill(255,255,255); textSize(28);
}
void draw() { //runs 60 times a second //background image loop if(genestate == 0) { //background(255,255,255); imageMode(CORNER); image(bgImg, x, 0); image(bgImg, x+bgImg.width, 0);
x -= 3;
vy += 1;
y += vy;
if(x == -1680) x=0;
//generate obstacle imgs
for(int i = 0; i < 2; i++){
imageMode(CENTER);
image(obsImg, wx[i], wy[i] - ((obsImg.height/2)+100));
image(obsImg, wx[i], wy[i] + (obsImg.height/2+100));
if(wx[i] < 0 ){
wy[i] = (int)random(200,height -200);
wx[i] = width;
}
//accumulative score
if(wx[i] == width/2){
playerScore.play();
playerScore = minim.loadFile("sfx_point.wav");
highScore = max(++score, highScore);
}
//bird image touch obstacle img, it will goes to genestate1
if(y>height || y<0 || (abs(width/2-wx[i])<25 && abs(y-wy[i]) > 100))
genestate=1;
wx[i] -= 6;
}
image(birdImg, width/2, y, 46, 30.5);
//calculate the score while middle pixel goes through the pipe
text(""+score, width/2-15, 70);
}
else{ imageMode(CENTER); image(menuImg, width/2, height/2); image(startBtn, width/2, 500); text(highScore, 350, width/2-15);
} }
void mousePressed(){ vy =- 17;
if(genestate == 1){
wx[0] = 600;
wy[0] = y = height/2;
wx[1] = 900;
wy[1] = 600;
x = genestate = score = 0;
}
}
void mouseClicked(){ if(genestate == 0){ playerSwing.play(); } }
void mouseReleased(){ playerSwing.close(); playerSwing = minim.loadFile("sfx_wing.wav", 705); }
void stop(){ playerBGM.close(); minim.stop(); super.stop();
}
processing file link here: https://www.dropbox.com/s/s1hokayheh3vv25/flyFarBird.rar?dl=0