diff --git a/res/images/bossBig.png b/res/images/bossBig.png new file mode 100644 index 0000000..c2b9986 Binary files /dev/null and b/res/images/bossBig.png differ diff --git a/res/images/bossBigShooting1.png b/res/images/bossBigShooting1.png new file mode 100644 index 0000000..b3f49fc Binary files /dev/null and b/res/images/bossBigShooting1.png differ diff --git a/res/images/bossBigShooting2.png b/res/images/bossBigShooting2.png new file mode 100644 index 0000000..bec7784 Binary files /dev/null and b/res/images/bossBigShooting2.png differ diff --git a/res/images/bossBigShooting3.png b/res/images/bossBigShooting3.png new file mode 100644 index 0000000..58181d1 Binary files /dev/null and b/res/images/bossBigShooting3.png differ diff --git a/res/images/bossEnemyTakeOff1.png b/res/images/bossEnemyTakeOff1.png new file mode 100644 index 0000000..9eaf989 Binary files /dev/null and b/res/images/bossEnemyTakeOff1.png differ diff --git a/res/images/bossEnemyTakeOff2.png b/res/images/bossEnemyTakeOff2.png new file mode 100644 index 0000000..2d20350 Binary files /dev/null and b/res/images/bossEnemyTakeOff2.png differ diff --git a/res/images/bossEnemyTakeOff3.png b/res/images/bossEnemyTakeOff3.png new file mode 100644 index 0000000..b4ab759 Binary files /dev/null and b/res/images/bossEnemyTakeOff3.png differ diff --git a/res/images/bossEnemyTakeOff4.png b/res/images/bossEnemyTakeOff4.png new file mode 100644 index 0000000..6457639 Binary files /dev/null and b/res/images/bossEnemyTakeOff4.png differ diff --git a/res/images/bossGun.png b/res/images/bossGun.png new file mode 100644 index 0000000..88f4a8b Binary files /dev/null and b/res/images/bossGun.png differ diff --git a/res/images/shop/shoprocket.png b/res/images/shop/shoprocket.png index 7f7b1df..e09a40b 100644 Binary files a/res/images/shop/shoprocket.png and b/res/images/shop/shoprocket.png differ diff --git a/res/images/shots/bossBeam.png b/res/images/shots/bossBeam.png new file mode 100644 index 0000000..b4b9c11 Binary files /dev/null and b/res/images/shots/bossBeam.png differ diff --git a/res/images/shots/bossRocket.png b/res/images/shots/bossRocket.png new file mode 100644 index 0000000..4ce86a5 Binary files /dev/null and b/res/images/shots/bossRocket.png differ diff --git a/res/levels/second.level b/res/levels/second.level index 7abaab2..07d07f7 100644 --- a/res/levels/second.level +++ b/res/levels/second.level @@ -19,4 +19,4 @@ spawn:EnemyTwo,1,10,60 spawn:EnemyThree,2,4,33 spawn:EnemyTwo,5,6,10 [25-30] -spawn:EnemyBoss,1,1,50 +spawn:EnemyBigBoss,1,1,1 diff --git a/src/de/teamteamteam/spacescooter/entity/Entity.java b/src/de/teamteamteam/spacescooter/entity/Entity.java index 4428de0..62ad585 100644 --- a/src/de/teamteamteam/spacescooter/entity/Entity.java +++ b/src/de/teamteamteam/spacescooter/entity/Entity.java @@ -31,7 +31,7 @@ public abstract class Entity implements Updateable, Paintable { /* Enemies */ EnemyOne, EnemyTwo, EnemyThree, EnemyFour, /* Boss Enemies and belongings */ - EnemyBoss, EnemyBossMinion, + EnemyBoss, EnemyBossMinion, EnemyBigBoss, /* Explosions */ ExplosionOne, ExplosionTwo, MultiExplosion, /* Stones */ @@ -222,4 +222,8 @@ public abstract class Entity implements Updateable, Paintable { this.disposed = true; } } + + public boolean isAlive() { + return !disposed; + } } diff --git a/src/de/teamteamteam/spacescooter/entity/Player.java b/src/de/teamteamteam/spacescooter/entity/Player.java index 682e64d..f815efe 100644 --- a/src/de/teamteamteam/spacescooter/entity/Player.java +++ b/src/de/teamteamteam/spacescooter/entity/Player.java @@ -1,6 +1,5 @@ package de.teamteamteam.spacescooter.entity; -import java.awt.Color; import java.awt.Graphics2D; import java.awt.event.KeyEvent; diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBigBoss.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBigBoss.java new file mode 100644 index 0000000..15f6af1 --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBigBoss.java @@ -0,0 +1,149 @@ +package de.teamteamteam.spacescooter.entity.enemy; + +import de.teamteamteam.spacescooter.brain.GameConfig; +import de.teamteamteam.spacescooter.entity.FlashImage; +import de.teamteamteam.spacescooter.entity.explosion.MultiExplosion; +import de.teamteamteam.spacescooter.entity.shot.BossBeamShooting; +import de.teamteamteam.spacescooter.entity.shot.BossEnemyTakeOff; +import de.teamteamteam.spacescooter.entity.shot.BossRocket; +import de.teamteamteam.spacescooter.gui.BossHealthBar; +import de.teamteamteam.spacescooter.screen.GameScreen; +import de.teamteamteam.spacescooter.utility.Random; + +public class EnemyBigBoss extends Enemy{ + + private int move = 1; + private int moveTickCounter = 0; + private int shotTickCounter = 0; + private int nextShot = 500; + private int thisShot; + private int lastShot; + private FlashImage flashBossImage; + private BossBeamShooting bbs; + private BossEnemyTakeOff beto; + private EnemyBigBossHitbox[] hitbox = new EnemyBigBossHitbox[3]; + private boolean hardmode = false; + + public EnemyBigBoss(int x, int y) { + super(x, y); + this.setImage("images/bossBig.png"); + this.setHealthPoints(8000); + this.setCollisionDamage(100); + this.setScore(10000); + this.setCollide(false); + this.willShoot = false; + this.hitbox[0] = new EnemyBigBossHitbox(409, 136, this); + this.hitbox[1] = new EnemyBigBossHitbox(192, 284, this); + this.hitbox[2] = new EnemyBigBossHitbox(74, 398, this); + new BossHealthBar(240, 5, this); + } + + @Override + public void die() { + if(flashBossImage != null) flashBossImage.remove(); + if(bbs != null) bbs.remove(); + if(beto != null) beto.remove(); + for(int i =0; i<3; i++){ + hitbox[i].remove(); + } + super.die(); + } + + /** + * Custom MultiExplosion for this enemy. + */ + @Override + public void explode() { + new MultiExplosion(this.getCenteredX()-2*96, this.getCenteredY()); + new MultiExplosion(this.getCenteredX()-96, this.getCenteredY()-92); + new MultiExplosion(this.getCenteredX()-96, this.getCenteredY()); + new MultiExplosion(this.getCenteredX()-96, this.getCenteredY()+92); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()-2*92); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()-92); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()+92); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()+2*92); + new MultiExplosion(this.getCenteredX()+96, this.getCenteredY()-2*92); + new MultiExplosion(this.getCenteredX()+96, this.getCenteredY()-92); + new MultiExplosion(this.getCenteredX()+96, this.getCenteredY()); + new MultiExplosion(this.getCenteredX()+96, this.getCenteredY()+92); + new MultiExplosion(this.getCenteredX()+96, this.getCenteredY()+2*92); + new MultiExplosion(this.getCenteredX()+2*96, this.getCenteredY()-92); + new MultiExplosion(this.getCenteredX()+2*96, this.getCenteredY()); + new MultiExplosion(this.getCenteredX()+2*96, this.getCenteredY()+92); + } + + @Override + public void update() { + super.update(); + hitbox[0].setPosition(this.getCenteredX(), this.getCenteredY()); + hitbox[1].setPosition(this.getCenteredX()+15, this.getCenteredY()); + hitbox[2].setPosition(this.getCenteredX()+33, this.getCenteredY()); + + //Move into the Screen until it fits on X-Axis + if(this.getX() > GameConfig.gameScreenWidth+GameConfig.gameScreenXOffset-this.getImageWidth()) { + this.transpose(-1, 0); + }else if(this.moveTickCounter > 2){//Move up and down with half speed + //Move up or down within the GameScreen. + this.transpose(0, this.move); + + if(bbs != null && bbs.isAlive()){ + bbs.positionUpdate(move); + } + if(beto != null){ + beto.positionUpdate(move); + } + if(this.getY() < GameConfig.gameScreenYOffset){ + this.move = 1; + } + if(this.getY() > GameConfig.gameScreenHeight + GameConfig.gameScreenYOffset - this.getImageHeight()){ + this.move = -1; + } + this.moveTickCounter = 0; + }else{ + this.moveTickCounter++; + } + + //Randomly fire + if(this.shotTickCounter == this.nextShot){ + + do{ + thisShot = Random.nextInt(4); + }while(thisShot == lastShot); + lastShot = thisShot; + switch (thisShot) { + case 0://Fire the rocket + if(!hardmode){ + if(GameScreen.getPlayer().getCenteredY() < this.getCenteredY()) new BossRocket(getCenteredX(), getCenteredY(), true); + else new BossRocket(getCenteredX(), getCenteredY(), false); + }else{ + new BossRocket(getCenteredX(), getCenteredY(), true); + new BossRocket(getCenteredX(), getCenteredY(), false); + } + flashBossImage = new FlashImage(this.getCenteredX(), this.getCenteredY(), "images/bossBig.png", 12); + break; + case 1://Fire the beam + bbs = new BossBeamShooting(getX(), getY(), this, 0, hardmode); + break; + case 2://Fire the shot wave + bbs = new BossBeamShooting(getX(), getY(), this, 1, hardmode); + break; + case 3://Enemy take off + beto = new BossEnemyTakeOff(getCenteredX()-7, getY(), hardmode); + break; + } + + if(getHealthPoints() >6000) this.nextShot = 400; + else if(getHealthPoints() >4000) this.nextShot = 300; + else if(getHealthPoints() >2000) this.nextShot = 250; + else{ + this.nextShot = 200; + hardmode = true; + } + this.shotTickCounter = 0; + }else{ + this.shotTickCounter++; + } + if(flashBossImage != null && flashBossImage.isAlive()) flashBossImage.setPosition(this.getX(), this.getY()); + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBigBossHitbox.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBigBossHitbox.java new file mode 100644 index 0000000..366fd4a --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBigBossHitbox.java @@ -0,0 +1,35 @@ +package de.teamteamteam.spacescooter.entity.enemy; + +import de.teamteamteam.spacescooter.entity.LivingEntity; +import de.teamteamteam.spacescooter.entity.Player; +import de.teamteamteam.spacescooter.entity.shot.Shot; +import de.teamteamteam.spacescooter.entity.spi.Collidable; + +public class EnemyBigBossHitbox extends LivingEntity{ + + EnemyBigBoss enemyBigBoss; + + public EnemyBigBossHitbox(int width, int height, EnemyBigBoss enemyBigBoss) { + super(0, 0); + this.setHitboxDimenstions(width, height); + this.enemyBigBoss = enemyBigBoss; + } + + @Override + public void collideWith(Collidable entity) { + if(entity instanceof EnemyBigBossHitbox) return; + if(entity instanceof Shot){ + Shot shot = (Shot) entity; + if(shot.getDirection() == Shot.LEFT) return; + enemyBigBoss.takeDamage(shot.getDamageValue()); + } + if (entity instanceof Player) { + Player player = (Player) entity; + enemyBigBoss.takeDamage(player.getCollisionDamage()); + } + } + + @Override + public void explode() {} + +} diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java index 877704a..7bbb046 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyFour.java @@ -63,9 +63,7 @@ public class EnemyFour extends Enemy{ nextPoint = points.get(index); index++; neuerVektor(); - }catch(IndexOutOfBoundsException e){ - this.remove(); - } + }catch(IndexOutOfBoundsException e){} } @Override diff --git a/src/de/teamteamteam/spacescooter/entity/item/ItemNuke.java b/src/de/teamteamteam/spacescooter/entity/item/ItemNuke.java index 7673f73..f08b89c 100644 --- a/src/de/teamteamteam/spacescooter/entity/item/ItemNuke.java +++ b/src/de/teamteamteam/spacescooter/entity/item/ItemNuke.java @@ -17,7 +17,7 @@ public class ItemNuke extends Item { } /** - * Gives every enemy 20 damage. Most enemies do not survive this. + * Gives every enemy 250 damage. Most enemies do not survive this. */ @Override public void itemCollected(Player player) { @@ -26,7 +26,7 @@ public class ItemNuke extends Item { while (entityIterator.hasNext()) { Entity entity = entityIterator.next(); if(entity instanceof Enemy) { - ((LivingEntity) entity).takeDamage(9001); + ((LivingEntity) entity).takeDamage(250); } } } diff --git a/src/de/teamteamteam/spacescooter/entity/shot/BossBeam.java b/src/de/teamteamteam/spacescooter/entity/shot/BossBeam.java new file mode 100644 index 0000000..2f34328 --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/shot/BossBeam.java @@ -0,0 +1,28 @@ +package de.teamteamteam.spacescooter.entity.shot; + +import de.teamteamteam.spacescooter.entity.spi.Collidable; + +public class BossBeam extends Shot{ + + private int lifetime = 0; + + public BossBeam(int x, int y) { + super(x-240, y, Shot.LEFT, 0, 1, "images/shots/bossBeam.png"); + } + + @Override + public void update() { + this.lifetime++; + if(this.lifetime>100){ + this.remove(); + } + } + + @Override + public void collideWith(Collidable entity) {} + + + public void positionUpdate(int y_delta){ + this.transpose(0, y_delta); + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/shot/BossBeamShooting.java b/src/de/teamteamteam/spacescooter/entity/shot/BossBeamShooting.java new file mode 100644 index 0000000..f650d7a --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/shot/BossBeamShooting.java @@ -0,0 +1,68 @@ +package de.teamteamteam.spacescooter.entity.shot; + +import de.teamteamteam.spacescooter.entity.Entity; +import de.teamteamteam.spacescooter.entity.enemy.EnemyBigBoss; +import de.teamteamteam.spacescooter.gui.ImageEntity; + +public class BossBeamShooting extends Entity{ + + private int lifetime = 0; + private ImageEntity front1; + private ImageEntity front2; + private ImageEntity bossGun; + private ImageEntity bossImage; + private EnemyBigBoss boss; + private BossBeam bb; + private BossShotWave bsw; + private int mode; + private boolean hardmode; + + public BossBeamShooting(int x, int y, EnemyBigBoss boss, int mode, boolean hardmode) { + super(x, y); + boss.setImage("images/bossBigShooting1.png"); + this.boss = boss; + this.bossGun = new ImageEntity(getX()+10, getY()+190, "images/bossGun.png"); + this.bossImage = new ImageEntity(x, y, "images/bossBigShooting1.png"); + this.front1 = new ImageEntity(getX(), getY(), "images/bossBigShooting2.png"); + this.front2 = new ImageEntity(getX(), getY(), "images/bossBigShooting3.png"); + this.mode = mode; + this.hardmode = hardmode; + } + + @Override + public void remove() { + front1.remove(); + front2.remove(); + bossGun.remove(); + bossImage.remove(); + if(bb != null) bb.remove(); + super.remove(); + } + + @Override + public void update() { + this.lifetime++; + if(this.lifetime<40){ + front1.transpose(0, -1); + front2.transpose(0, 1); + }else if(this.lifetime == 50){ + if(mode == 0) bb = new BossBeam(this.getX(), this.getY()+200); + else bsw = new BossShotWave(this.getX()-10, this.getY()+200, hardmode); + }else if(this.lifetime>160 && this.lifetime<200){ + front1.transpose(0, 1); + front2.transpose(0, -1); + }else if(this.lifetime == 200){ + boss.setImage("images/bossBig.png"); + this.remove(); + } + } + + public void positionUpdate(int y_delta){ + front1.transpose(0, y_delta); + front2.transpose(0, y_delta); + bossGun.transpose(0, y_delta); + bossImage.transpose(0, y_delta); + if(bb != null && bb.isAlive()) bb.positionUpdate(y_delta); + if(bsw != null && bsw.isAlive()) bsw.positionUpdate(y_delta); + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/shot/BossEnemyTakeOff.java b/src/de/teamteamteam/spacescooter/entity/shot/BossEnemyTakeOff.java new file mode 100644 index 0000000..035dd78 --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/shot/BossEnemyTakeOff.java @@ -0,0 +1,90 @@ +package de.teamteamteam.spacescooter.entity.shot; + +import java.awt.Point; +import java.util.ArrayList; + +import de.teamteamteam.spacescooter.entity.Entity; +import de.teamteamteam.spacescooter.entity.enemy.EnemyFour; +import de.teamteamteam.spacescooter.gui.ImageEntity; +import de.teamteamteam.spacescooter.screen.GameScreen; + +public class BossEnemyTakeOff extends Entity{ + + private boolean hardmode; + private ImageEntity image1; + private ImageEntity image2; + private ImageEntity image3; + private ImageEntity image4; + private ImageEntity imageEnemyFour; + private int lifetime; + private ArrayList points = new ArrayList(); + + public BossEnemyTakeOff(int x, int y, boolean hardmode) { + super(x, y); + this.setImageDimensions(57, 399); + this.hardmode = hardmode; + this.image4 = new ImageEntity(x, y, "images/bossEnemyTakeOff4.png"); + this.imageEnemyFour = new ImageEntity(getCenteredX()-10, getCenteredY()-15, "images/enemy01.png"); + this.image2 = new ImageEntity(x, y, "images/bossEnemyTakeOff2.png"); + this.image3 = new ImageEntity(x, y, "images/bossEnemyTakeOff3.png"); + this.image1 = new ImageEntity(x, y, "images/bossEnemyTakeOff1.png"); + } + + @Override + public void remove() { + this.image1.remove(); + this.image2.remove(); + this.image3.remove(); + this.image4.remove(); + this.imageEnemyFour.remove(); + super.remove(); + } + + @Override + public void update() { + this.lifetime++; + if(this.lifetime<40){ + this.image2.transpose(0, -1); + this.image3.transpose(0, 1); + }else if(this.lifetime == 50){ + points.add(new Point(GameScreen.getPlayer().getCenteredX(), GameScreen.getPlayer().getCenteredY())); + new EnemyFour(getCenteredX()-10, getCenteredY()-15, points); + }else if(this.lifetime == 65 && hardmode){ + points.remove(0); + points.add(new Point(GameScreen.getPlayer().getCenteredX(), GameScreen.getPlayer().getCenteredY())); + new EnemyFour(getCenteredX()-10, getCenteredY()-15, points); + }else if(this.lifetime == 80){ + points.remove(0); + points.add(new Point(GameScreen.getPlayer().getCenteredX(), GameScreen.getPlayer().getCenteredY())); + new EnemyFour(getCenteredX()-10, getCenteredY()-15, points); + }else if(this.lifetime == 95 && hardmode){ + points.remove(0); + points.add(new Point(GameScreen.getPlayer().getCenteredX(), GameScreen.getPlayer().getCenteredY())); + new EnemyFour(getCenteredX()-10, getCenteredY()-15, points); + }else if(this.lifetime == 110){ + points.remove(0); + points.add(new Point(GameScreen.getPlayer().getCenteredX(), GameScreen.getPlayer().getCenteredY())); + if(!hardmode) imageEnemyFour.remove(); + new EnemyFour(getCenteredX()-10, getCenteredY()-15, points); + }else if(this.lifetime == 125 && hardmode){ + points.remove(0); + points.add(new Point(GameScreen.getPlayer().getCenteredX(), GameScreen.getPlayer().getCenteredY())); + imageEnemyFour.remove(); + new EnemyFour(getCenteredX()-10, getCenteredY()-15, points); + }else if(this.lifetime>160 && this.lifetime<200){ + this.image2.transpose(0, 1); + this.image3.transpose(0, -1); + }else if(this.lifetime == 200){ + this.remove(); + } + } + + public void positionUpdate(int y_delta){ + this.image1.transpose(0, y_delta); + this.image2.transpose(0, y_delta); + this.image3.transpose(0, y_delta); + this.image4.transpose(0, y_delta); + this.imageEnemyFour.transpose(0, y_delta); + this.transpose(0, y_delta); + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/shot/BossRocket.java b/src/de/teamteamteam/spacescooter/entity/shot/BossRocket.java new file mode 100644 index 0000000..4fd8e83 --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/shot/BossRocket.java @@ -0,0 +1,57 @@ +package de.teamteamteam.spacescooter.entity.shot; + +import java.awt.Graphics2D; + +import de.teamteamteam.spacescooter.entity.enemy.Enemy; +import de.teamteamteam.spacescooter.entity.enemy.EnemyBigBossHitbox; +import de.teamteamteam.spacescooter.entity.explosion.MultiExplosion; +import de.teamteamteam.spacescooter.entity.spi.Collidable; +import de.teamteamteam.spacescooter.screen.GameScreen; + +public class BossRocket extends Shot { + + private double rotation = 0; + private int lifeTime = 0; + + public BossRocket(int x, int y, boolean upperRocket) { + super(x, y, Shot.LEFT, 3, 50, "images/shots/bossRocket.png"); + if(upperRocket) this.setPosition(x-85, y-143); + else this.setPosition(x-85, y+93); + } + + @Override + public void update(){ + if(lifeTime > 30){ + if(GameScreen.getPlayer().getCenteredY() < this.getCenteredY() - 20){ + this.transpose(0, -1); + rotation = 0.1; + }else if(GameScreen.getPlayer().getCenteredY() > this.getCenteredY() + 20){ + this.transpose(0, 1); + rotation = -0.1; + }else{ + rotation = 0; + } + } + lifeTime++; + super.update(); + } + + @Override + public void paint(Graphics2D g) { + g.rotate(rotation); + super.paint(g); + g.rotate(-rotation); + } + + @Override + public void collideWith(Collidable entity) { + if(entity instanceof EnemyBigBossHitbox) return; + super.collideWith(entity); + if(this.getDirection() == LEFT && entity instanceof Enemy) return; + new MultiExplosion(this.getX(), this.getCenteredY()); + new MultiExplosion(this.getX()+(int)(this.getHitboxWidth()*0.25), this.getCenteredY()); + new MultiExplosion(this.getCenteredX(), this.getCenteredY()); + new MultiExplosion(this.getX()+(int)(this.getHitboxWidth()*0.75), this.getCenteredY()); + new MultiExplosion(this.getX()+this.getHitboxWidth(), this.getCenteredY()); + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/shot/BossShot.java b/src/de/teamteamteam/spacescooter/entity/shot/BossShot.java new file mode 100644 index 0000000..cb67c4a --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/shot/BossShot.java @@ -0,0 +1,40 @@ +package de.teamteamteam.spacescooter.entity.shot; + + +public class BossShot extends Shot{ + + private double x; + private double y; + private double vektorX; + private double vektorY; + private int speed = 5; + private int counter; + private int mode; + + public BossShot(int x, int y, int counter, int mode) { + super(x, y, Shot.LEFT, 0, 2, "images/shots/ballshot.png"); + this.counter = counter; + this.x = x; + this.y = y; + this.mode = mode; + neuerVektor(); + } + + @Override + public void update() { + super.update(); + + this.x -= this.vektorX*this.speed; + this.y -= this.vektorY*this.speed; + this.setPosition((int)this.x, (int)this.y); + } + + private void neuerVektor(){ + this.vektorX = (this.getX()); + if(mode == 0) this.vektorY = (this.getY() - (600-(counter*5))); + else this.vektorY = (this.getY() - (60+(counter*5))); + double laenge = Math.sqrt(this.vektorX * this.vektorX + this.vektorY * this.vektorY); + this.vektorX = vektorX/laenge; + this.vektorY = vektorY/laenge; + } +} diff --git a/src/de/teamteamteam/spacescooter/entity/shot/BossShotWave.java b/src/de/teamteamteam/spacescooter/entity/shot/BossShotWave.java new file mode 100644 index 0000000..e4a6257 --- /dev/null +++ b/src/de/teamteamteam/spacescooter/entity/shot/BossShotWave.java @@ -0,0 +1,34 @@ +package de.teamteamteam.spacescooter.entity.shot; + +import de.teamteamteam.spacescooter.entity.Entity; +import de.teamteamteam.spacescooter.utility.Random; + +public class BossShotWave extends Entity{ + + private int lifetime = 0; + private int rand; + private boolean hardmode; + + public BossShotWave(int x, int y, boolean hardmode) { + super(x, y); + this.rand = Random.nextInt(2); + this.hardmode = hardmode; + } + + @Override + public void update() { + this.lifetime++; + if(!hardmode) new BossShot(getX(), getY(), lifetime, rand); + else{ + new BossShot(getX(), getY(), lifetime, 0); + new BossShot(getX(), getY(), lifetime, 1); + } + if(lifetime == 100) this.remove(); + } + + public void positionUpdate(int y_delta) { + this.transpose(0, y_delta); + } + + +} diff --git a/src/de/teamteamteam/spacescooter/level/Level.java b/src/de/teamteamteam/spacescooter/level/Level.java index c834081..fb7aaac 100644 --- a/src/de/teamteamteam/spacescooter/level/Level.java +++ b/src/de/teamteamteam/spacescooter/level/Level.java @@ -15,6 +15,7 @@ import de.teamteamteam.spacescooter.datastructure.ConcurrentIterator; import de.teamteamteam.spacescooter.entity.Entity; import de.teamteamteam.spacescooter.entity.Player; import de.teamteamteam.spacescooter.entity.enemy.Enemy; +import de.teamteamteam.spacescooter.entity.enemy.EnemyBigBoss; import de.teamteamteam.spacescooter.entity.enemy.EnemyBoss; import de.teamteamteam.spacescooter.entity.enemy.EnemyFour; import de.teamteamteam.spacescooter.entity.enemy.EnemyOne; @@ -281,6 +282,9 @@ public final class Level { case EnemyBoss: spawnedEntity = new EnemyBoss(x, y); break; + case EnemyBigBoss: + spawnedEntity = new EnemyBigBoss(x, y); + break; case StoneOne: spawnedEntity = new StoneOne(x, y); break;