diff --git a/res/levels/test.level b/res/levels/test.level index 1203ecb..cfc2f15 100644 --- a/res/levels/test.level +++ b/res/levels/test.level @@ -2,7 +2,9 @@ name:Testlevel \o/ backgroundMusic:music/ScooterFriendsTurbo8Bit.wav background:CloudBackground - -[0-2] +[0-1] +spawn:EnemyBoss,1,1,50 +[1-2] spawn:StoneOne,2,1,0 spawn:StoneOne,2,1,10 spawn:StoneOne,2,1,20 diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/Enemy.java b/src/de/teamteamteam/spacescooter/entity/enemy/Enemy.java index fad2d2e..cc23a19 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/Enemy.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/Enemy.java @@ -2,7 +2,9 @@ package de.teamteamteam.spacescooter.entity.enemy; import de.teamteamteam.spacescooter.brain.PlayerSession; import de.teamteamteam.spacescooter.entity.ShootingEntity; +import de.teamteamteam.spacescooter.entity.obstacle.Obstacle; import de.teamteamteam.spacescooter.entity.shot.Shot; +import de.teamteamteam.spacescooter.entity.spi.Collidable; import de.teamteamteam.spacescooter.sound.SoundSystem; import de.teamteamteam.spacescooter.utility.Random; /** @@ -50,6 +52,15 @@ public abstract class Enemy extends ShootingEntity { } } + /** + * Enemies are smart enough to dodge Obstacles. + */ + @Override + public void collideWith(Collidable entity) { + if(entity instanceof Obstacle) return; + super.collideWith(entity); + } + /** * Every enemy that dies awards the Player one credit and points. */ diff --git a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java index 1e9d702..b4ea41b 100644 --- a/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java +++ b/src/de/teamteamteam/spacescooter/entity/enemy/EnemyBoss.java @@ -43,14 +43,23 @@ public class EnemyBoss extends Enemy{ @Override public void update() { super.update(); - this.setPosition(GameConfig.windowWidth-65, this.getY()+move); - if(this.getY() == 51){ + //Move into the Screen until it fits on X-Axis + if(this.getX() > GameConfig.gameScreenWidth+GameConfig.gameScreenXOffset-this.getWidth()) { + this.transpose(-1, 0); + } + //Move up or down within the GameScreen. + this.transpose(0, move); + if(this.getY() == GameConfig.gameScreenYOffset){ move = 1; } - if(this.getY() == 560){ + if(this.getY() == GameConfig.gameScreenHeight + GameConfig.gameScreenYOffset - this.getHeight()){ move = -1; } - if(Random.nextInt(1000) < 5) new EnemyBossMinion(730, this.getY()); + //Randomly spawn minions. + if(Random.nextInt(1000) < 5) { + new EnemyBossMinion(GameConfig.gameScreenWidth +GameConfig.gameScreenXOffset - this.getWidth(), this.getY()); + } + //Randomly fire doubleshots. if(Random.nextInt(1000) < 50) { createCustomShot(-10, 3, 8, 5, "images/shots/laser_red.png"); createCustomShot(-10, 59, 8, 5, "images/shots/laser_red.png");