KaranMohindroo / Flappy-Bird

Java based game
1 stars 0 forks source link

Collision #1

Open KaranMohindroo opened 6 years ago

KaranMohindroo commented 6 years ago

When the dragon collides with the pipe's head game should end but it doesn't. Below is the code for collision. Which is not working as expected

https://github.com/KaranMohindroo/Flappy-Bird/blob/master/FlappyBird.java#L76

KaranMohindroo commented 6 years ago

image image

himakshi25 commented 6 years ago

I have modified the collision code maybe it is working better than before

if(r.contains(bird.x+60, bird.y+50)) { JOptionPane.showMessageDialog(frame, "You lose!\n"+"Your score was: "+time/60+"."); game = false; if(hs<time/60) { hs=time/60; } } if(r.contains(bird.x-60, bird.y-50)) { JOptionPane.showMessageDialog(frame, "You lose!\n"+"Your score was: "+time/60+"."); game = false; if(hs<time/60) { hs=time/60; } } https://github.com/KaranMohindroo/Flappy-Bird/blob/master/FlappyBird.java#L81