Apply cool new position stuff to EnemyBoss.

This commit is contained in:
Jan Philipp Timme 2014-12-02 12:51:27 +01:00
parent 110cc98c3b
commit f1c95bf4d9
3 changed files with 27 additions and 5 deletions

View File

@ -2,7 +2,9 @@ name:Testlevel \o/
backgroundMusic:music/ScooterFriendsTurbo8Bit.wav backgroundMusic:music/ScooterFriendsTurbo8Bit.wav
background:CloudBackground background:CloudBackground
- -
[0-2] [0-1]
spawn:EnemyBoss,1,1,50
[1-2]
spawn:StoneOne,2,1,0 spawn:StoneOne,2,1,0
spawn:StoneOne,2,1,10 spawn:StoneOne,2,1,10
spawn:StoneOne,2,1,20 spawn:StoneOne,2,1,20

View File

@ -2,7 +2,9 @@ package de.teamteamteam.spacescooter.entity.enemy;
import de.teamteamteam.spacescooter.brain.PlayerSession; import de.teamteamteam.spacescooter.brain.PlayerSession;
import de.teamteamteam.spacescooter.entity.ShootingEntity; 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.shot.Shot;
import de.teamteamteam.spacescooter.entity.spi.Collidable;
import de.teamteamteam.spacescooter.sound.SoundSystem; import de.teamteamteam.spacescooter.sound.SoundSystem;
import de.teamteamteam.spacescooter.utility.Random; 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. * Every enemy that dies awards the Player one credit and points.
*/ */

View File

@ -43,14 +43,23 @@ public class EnemyBoss extends Enemy{
@Override @Override
public void update() { public void update() {
super.update(); super.update();
this.setPosition(GameConfig.windowWidth-65, this.getY()+move); //Move into the Screen until it fits on X-Axis
if(this.getY() == 51){ 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; move = 1;
} }
if(this.getY() == 560){ if(this.getY() == GameConfig.gameScreenHeight + GameConfig.gameScreenYOffset - this.getHeight()){
move = -1; 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) { if(Random.nextInt(1000) < 50) {
createCustomShot(-10, 3, 8, 5, "images/shots/laser_red.png"); createCustomShot(-10, 3, 8, 5, "images/shots/laser_red.png");
createCustomShot(-10, 59, 8, 5, "images/shots/laser_red.png"); createCustomShot(-10, 59, 8, 5, "images/shots/laser_red.png");