diff --git a/res/images/explosion2_1.png b/res/images/explosion2_1.png index 9af1943..fb81572 100644 Binary files a/res/images/explosion2_1.png and b/res/images/explosion2_1.png differ diff --git a/res/images/explosion2_10.png b/res/images/explosion2_10.png index b35cdc2..076c6f5 100644 Binary files a/res/images/explosion2_10.png and b/res/images/explosion2_10.png differ diff --git a/res/images/explosion2_11.png b/res/images/explosion2_11.png index e04e5ca..67776fa 100644 Binary files a/res/images/explosion2_11.png and b/res/images/explosion2_11.png differ diff --git a/res/images/explosion2_12.png b/res/images/explosion2_12.png index 9f58c3b..c15b1da 100644 Binary files a/res/images/explosion2_12.png and b/res/images/explosion2_12.png differ diff --git a/res/images/explosion2_13.png b/res/images/explosion2_13.png index b5aa4e8..fbb970a 100644 Binary files a/res/images/explosion2_13.png and b/res/images/explosion2_13.png differ diff --git a/res/images/explosion2_14.png b/res/images/explosion2_14.png index f3e4592..d6441bd 100644 Binary files a/res/images/explosion2_14.png and b/res/images/explosion2_14.png differ diff --git a/res/images/explosion2_15.png b/res/images/explosion2_15.png index 88a6584..b0ce6b8 100644 Binary files a/res/images/explosion2_15.png and b/res/images/explosion2_15.png differ diff --git a/res/images/explosion2_16.png b/res/images/explosion2_16.png new file mode 100644 index 0000000..58352d2 Binary files /dev/null and b/res/images/explosion2_16.png differ diff --git a/res/images/explosion2_2.png b/res/images/explosion2_2.png index 332ca65..89d10cb 100644 Binary files a/res/images/explosion2_2.png and b/res/images/explosion2_2.png differ diff --git a/res/images/explosion2_3.png b/res/images/explosion2_3.png index 6252c66..4a45d9e 100644 Binary files a/res/images/explosion2_3.png and b/res/images/explosion2_3.png differ diff --git a/res/images/explosion2_4.png b/res/images/explosion2_4.png index a7835a4..e625b05 100644 Binary files a/res/images/explosion2_4.png and b/res/images/explosion2_4.png differ diff --git a/res/images/explosion2_5.png b/res/images/explosion2_5.png index 4c3cf65..fb873ef 100644 Binary files a/res/images/explosion2_5.png and b/res/images/explosion2_5.png differ diff --git a/res/images/explosion2_6.png b/res/images/explosion2_6.png index 8e48f9c..c19adbf 100644 Binary files a/res/images/explosion2_6.png and b/res/images/explosion2_6.png differ diff --git a/res/images/explosion2_7.png b/res/images/explosion2_7.png index a9f5dfe..e8119c1 100644 Binary files a/res/images/explosion2_7.png and b/res/images/explosion2_7.png differ diff --git a/res/images/explosion2_8.png b/res/images/explosion2_8.png index b76f7aa..27acd39 100644 Binary files a/res/images/explosion2_8.png and b/res/images/explosion2_8.png differ diff --git a/res/images/explosion2_9.png b/res/images/explosion2_9.png index abdc33a..33ca5cf 100644 Binary files a/res/images/explosion2_9.png and b/res/images/explosion2_9.png differ diff --git a/src/de/teamteamteam/spacescooter/entity/EnemyFour.java b/src/de/teamteamteam/spacescooter/entity/EnemyFour.java new file mode 100644 index 0000000..efddfde --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/EnemyFour.java @@ -0,0 +1,62 @@ +package de.teamteamteam.spacescooter.entity; + +import java.awt.Point; +import java.util.ArrayList; + +public class EnemyFour extends Enemy{ + + private ArrayList points; + private int index =0; + private Point nextPoint; + private double x; + private double y; + private double vektorX; + private double vektorY; + + public EnemyFour(int x, int y, ArrayList points) { + super(x, y); + this.setImage("images/nyancat.png"); + this.setShootSpeed(4); + this.setShootDelay(42); + this.setShootSpawn(-10, 10); + this.setHealthPoints(5); + this.points = points; + this.x = x; + this.y = y; + getNextPoint(); + } + + @Override + public void update() { + super.update(); + + this.x -= vektorX; + this.y -= vektorY; + this.setPosition((int)x, (int)y); + + if(this.getX() == (int)nextPoint.getX() && this.getY() == (int)nextPoint.getY()){ + getNextPoint(); + } + } + + private void neuerVektor(){ + vektorX = (this.getX() - nextPoint.getX()); + vektorY = (this.getY() - nextPoint.getY()); + double laenge = Math.sqrt(this.vektorX * this.vektorX + this.vektorY * this.vektorY); + vektorX = vektorX/laenge; + vektorY = vektorY/laenge; + } + + private void getNextPoint(){ + try{ + nextPoint = points.get(index); + index++; + neuerVektor(); + System.out.println("neuer point"); + }catch(IndexOutOfBoundsException e){ + System.out.println("ich bin dann mal weg!!"); + this.remove(); + } + } + +} diff --git a/src/de/teamteamteam/spacescooter/entity/ExplosionBig.java b/src/de/teamteamteam/spacescooter/entity/ExplosionBig.java index 5409d6b..eb6f8cf 100644 --- a/src/de/teamteamteam/spacescooter/entity/ExplosionBig.java +++ b/src/de/teamteamteam/spacescooter/entity/ExplosionBig.java @@ -60,6 +60,9 @@ public class ExplosionBig extends Explosion { case 10: this.setImage("images/explosion2_15.png"); break; + case 1: + this.setImage("images/explosion2_16.png"); + break; } } diff --git a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java index f4b11ac..0c2f8a6 100644 --- a/src/de/teamteamteam/spacescooter/entity/LivingEntity.java +++ b/src/de/teamteamteam/spacescooter/entity/LivingEntity.java @@ -81,14 +81,13 @@ public abstract class LivingEntity extends Entity implements Collidable { if (this.isAlive() == false) { if(GameConfig.DEBUG) System.out.println(this + " ist gestorben. RIP"); 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) { + if (rnd.nextInt(99) < 70) { Screen.currentScreen.addEntity(new Explosion(this.x, this.y)); } else { Screen.currentScreen.addEntity(new ExplosionBig(this.x, this.y)); diff --git a/src/de/teamteamteam/spacescooter/screen/GameScreen.java b/src/de/teamteamteam/spacescooter/screen/GameScreen.java index 6d8d718..7aef9ad 100644 --- a/src/de/teamteamteam/spacescooter/screen/GameScreen.java +++ b/src/de/teamteamteam/spacescooter/screen/GameScreen.java @@ -1,12 +1,15 @@ package de.teamteamteam.spacescooter.screen; import java.awt.Graphics2D; +import java.awt.Point; import java.awt.event.KeyEvent; +import java.util.ArrayList; import java.util.Iterator; import java.util.LinkedList; import de.teamteamteam.spacescooter.background.StarBackground; import de.teamteamteam.spacescooter.control.Keyboard; +import de.teamteamteam.spacescooter.entity.EnemyFour; import de.teamteamteam.spacescooter.entity.EnemyThree; import de.teamteamteam.spacescooter.entity.EnemyTwo; import de.teamteamteam.spacescooter.entity.Entity; @@ -14,10 +17,16 @@ import de.teamteamteam.spacescooter.entity.Player; public class GameScreen extends Screen { + private ArrayList points = new ArrayList(); + public GameScreen(Screen parent) { super(parent); + points.add(new Point(300,300)); + points.add(new Point(600,100)); + points.add(new Point(0,500)); this.entities.add(new StarBackground(0, 0)); this.entities.add(new Player(200, 300)); + this.entities.add(new EnemyFour(800, 400, points)); this.entities.add(new EnemyThree(650, 300)); this.entities.add(new EnemyThree(450, 100)); this.entities.add(new EnemyTwo(750, 550));