diff --git a/res/images/explosion2_1.png b/res/images/explosion2_1.png new file mode 100644 index 0000000..9af1943 Binary files /dev/null and b/res/images/explosion2_1.png differ diff --git a/res/images/explosion2_10.png b/res/images/explosion2_10.png new file mode 100644 index 0000000..b35cdc2 Binary files /dev/null and b/res/images/explosion2_10.png differ diff --git a/res/images/explosion2_11.png b/res/images/explosion2_11.png new file mode 100644 index 0000000..e04e5ca Binary files /dev/null and b/res/images/explosion2_11.png differ diff --git a/res/images/explosion2_12.png b/res/images/explosion2_12.png new file mode 100644 index 0000000..9f58c3b Binary files /dev/null and b/res/images/explosion2_12.png differ diff --git a/res/images/explosion2_13.png b/res/images/explosion2_13.png new file mode 100644 index 0000000..b5aa4e8 Binary files /dev/null and b/res/images/explosion2_13.png differ diff --git a/res/images/explosion2_14.png b/res/images/explosion2_14.png new file mode 100644 index 0000000..f3e4592 Binary files /dev/null and b/res/images/explosion2_14.png differ diff --git a/res/images/explosion2_15.png b/res/images/explosion2_15.png new file mode 100644 index 0000000..88a6584 Binary files /dev/null and b/res/images/explosion2_15.png differ diff --git a/res/images/explosion2_2.png b/res/images/explosion2_2.png new file mode 100644 index 0000000..332ca65 Binary files /dev/null and b/res/images/explosion2_2.png differ diff --git a/res/images/explosion2_3.png b/res/images/explosion2_3.png new file mode 100644 index 0000000..6252c66 Binary files /dev/null and b/res/images/explosion2_3.png differ diff --git a/res/images/explosion2_4.png b/res/images/explosion2_4.png new file mode 100644 index 0000000..a7835a4 Binary files /dev/null and b/res/images/explosion2_4.png differ diff --git a/res/images/explosion2_5.png b/res/images/explosion2_5.png new file mode 100644 index 0000000..4c3cf65 Binary files /dev/null and b/res/images/explosion2_5.png differ diff --git a/res/images/explosion2_6.png b/res/images/explosion2_6.png new file mode 100644 index 0000000..8e48f9c Binary files /dev/null and b/res/images/explosion2_6.png differ diff --git a/res/images/explosion2_7.png b/res/images/explosion2_7.png new file mode 100644 index 0000000..a9f5dfe Binary files /dev/null and b/res/images/explosion2_7.png differ diff --git a/res/images/explosion2_8.png b/res/images/explosion2_8.png new file mode 100644 index 0000000..b76f7aa Binary files /dev/null and b/res/images/explosion2_8.png differ diff --git a/res/images/explosion2_9.png b/res/images/explosion2_9.png new file mode 100644 index 0000000..abdc33a Binary files /dev/null and b/res/images/explosion2_9.png differ diff --git a/src/de/teamteamteam/spacescooter/entity/ExplosionBig.java b/src/de/teamteamteam/spacescooter/entity/ExplosionBig.java new file mode 100644 index 0000000..5409d6b --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/ExplosionBig.java @@ -0,0 +1,66 @@ +package de.teamteamteam.spacescooter.entity; + +public class ExplosionBig extends Explosion { + + private int count = 141; + + public ExplosionBig(int x, int y) { + super(x, y); + } + + public void update() { + if (count >= 0) { + count--; + } else { + this.remove(); + } + switch (count) { + case 150: + this.setImage("images/explosion2_1.png"); + break; + case 140: + this.setImage("images/explosion2_2.png"); + break; + case 130: + this.setImage("images/explosion2_3.png"); + break; + case 120: + this.setImage("images/explosion2_4.png"); + break; + case 110: + this.setImage("images/explosion2_5.png"); + break; + case 100: + this.setImage("images/explosion2_6.png"); + break; + case 90: + this.setImage("images/explosion2_7.png"); + break; + case 80: + this.setImage("images/explosion2_8.png"); + break; + case 70: + this.setImage("images/explosion2_9.png"); + break; + case 60: + this.setImage("images/explosion2_10.png"); + break; + case 50: + this.setImage("images/explosion2_11.png"); + break; + case 40: + this.setImage("images/explosion2_12.png"); + break; + case 30: + this.setImage("images/explosion2_13.png"); + break; + case 20: + this.setImage("images/explosion2_14.png"); + break; + case 10: + this.setImage("images/explosion2_15.png"); + break; + } + } + +} diff --git a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java index 687965d..f4b11ac 100644 --- a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java @@ -2,6 +2,7 @@ package de.teamteamteam.spacescooter.entity; import java.awt.Rectangle; import java.util.LinkedList; +import java.util.Random; import de.teamteamteam.spacescooter.screen.Screen; import de.teamteamteam.spacescooter.utility.GameConfig; @@ -79,11 +80,21 @@ public abstract class LivingEntity extends Entity implements Collidable { this.healthPoints -= damage; if (this.isAlive() == false) { if(GameConfig.DEBUG) System.out.println(this + " ist gestorben. RIP"); - Screen.currentScreen.addEntity(new Explosion(this.x, this.y)); + this.explode(); + //Screen.currentScreen.addEntity(new Explosion(this.x, this.y)); this.remove(); } } + private void explode() { + Random rnd = new Random(); + if (rnd.nextInt(10) < 7) { + Screen.currentScreen.addEntity(new Explosion(this.x, this.y)); + } else { + Screen.currentScreen.addEntity(new ExplosionBig(this.x, this.y)); + } + } + public void setHealthPoints(int hp) { this.healthPoints = hp; } diff --git a/src/de/teamteamteam/spacescooter/screen/GameScreen.java b/src/de/teamteamteam/spacescooter/screen/GameScreen.java index c4a5214..6d8d718 100644 --- a/src/de/teamteamteam/spacescooter/screen/GameScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GameScreen.java @@ -10,7 +10,6 @@ import de.teamteamteam.spacescooter.control.Keyboard; import de.teamteamteam.spacescooter.entity.EnemyThree; import de.teamteamteam.spacescooter.entity.EnemyTwo; import de.teamteamteam.spacescooter.entity.Entity; -import de.teamteamteam.spacescooter.entity.Explosion; import de.teamteamteam.spacescooter.entity.Player; public class GameScreen extends Screen { @@ -23,7 +22,6 @@ public class GameScreen extends Screen { this.entities.add(new EnemyThree(450, 100)); this.entities.add(new EnemyTwo(750, 550)); this.entities.add(new EnemyTwo(150, 250)); - this.entities.add(new Explosion(200, 200)); } @Override