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); throw new RuntimeException(e);
} }
checkCollision(); checkCollision();
try {
updateParticle();
} catch (IOException e) {
throw new RuntimeException(e);
}
if (playerFrameCounter > 5) { if (playerFrameCounter > 5) {
// increment sprite image to be used and keeps it below 12 // increment sprite image to be used and keeps it below 12
playerFrame = (playerFrame + 1) % 11; playerFrame = (playerFrame + 1) % 11;
@ -271,8 +276,11 @@ public class GamePanel extends JPanel implements Runnable, KeyListener{
public void updateParticle() throws IOException { public void updateParticle() throws IOException {
for(Tile t: particleTiles){ 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"));
}
}
} }
//if a key is pressed, we'll send it over to the Player class for processing //if a key is pressed, we'll send it over to the Player class for processing