Made lava particles better

master
bob 2022-06-08 14:50:45 -04:00
parent ac873cf221
commit 0fbe9cf522
1 changed files with 10 additions and 2 deletions

View File

@ -257,6 +257,11 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
throw new RuntimeException(e);
}
checkCollision();
try {
updateParticle();
} catch (IOException e) {
throw new RuntimeException(e);
}
if (playerFrameCounter > 5) {
// increment sprite image to be used and keeps it below 12
playerFrame = (playerFrame + 1) % 11;
@ -271,7 +276,10 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
public void updateParticle() throws IOException {
for(Tile t: particleTiles){
particles.add(new Particle(t.realX+Tile.length/2,t.y+Tile.length/2 ,GlobalState.randInt(-3,3),GlobalState.randInt(-3,3),GlobalState.randInt(1,5),"img/particles/LavaParticle.png"));
if(GlobalState.randInt(1,10)==1) {
particles.add(new Particle(t.x + GlobalState.randInt(0, Tile.length), t.y + GlobalState.randInt(0, Tile.length / 2),
GlobalState.randInt(-3, 3), GlobalState.randInt(-5, 2), GlobalState.randInt(5, 9), "img/particles/LavaParticle.png"));
}
}
}