Add the other two Stones to the game.
This commit is contained in:
parent
f1c95bf4d9
commit
e8400f4f34
@ -7,15 +7,15 @@ spawn:EnemyBoss,1,1,50
|
|||||||
[1-2]
|
[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:StoneTwo,2,1,20
|
||||||
spawn:StoneOne,2,1,30
|
spawn:StoneOne,2,1,30
|
||||||
spawn:StoneOne,2,1,40
|
spawn:StoneTwo,2,1,40
|
||||||
spawn:EnemyOne,2,1,50
|
spawn:EnemyOne,2,1,50
|
||||||
spawn:StoneOne,2,1,60
|
spawn:StoneOne,2,1,60
|
||||||
spawn:StoneOne,2,1,70
|
spawn:StoneThree,2,1,70
|
||||||
spawn:StoneOne,2,1,80
|
spawn:StoneOne,2,1,80
|
||||||
spawn:StoneOne,2,1,90
|
spawn:StoneThree,2,1,90
|
||||||
spawn:StoneOne,2,1,100
|
spawn:StoneThree,2,1,100
|
||||||
[2-4]
|
[2-4]
|
||||||
spawn:EnemyOne,1,5,20
|
spawn:EnemyOne,1,5,20
|
||||||
spawn:StoneOne,4,5,50
|
spawn:StoneOne,4,5,50
|
||||||
|
@ -35,7 +35,7 @@ public abstract class Entity implements Updateable, Paintable {
|
|||||||
/* Explosions */
|
/* Explosions */
|
||||||
ExplosionOne, ExplosionTwo, MultiExplosion,
|
ExplosionOne, ExplosionTwo, MultiExplosion,
|
||||||
/* Stones */
|
/* Stones */
|
||||||
StoneOne,
|
StoneOne, StoneTwo, StoneThree,
|
||||||
/* Items */
|
/* Items */
|
||||||
ItemCredit, ItemHeal, ItemIncreaseDamage, ItemNuke, ItemOneUp, ItemRocket, ItemShield,
|
ItemCredit, ItemHeal, ItemIncreaseDamage, ItemNuke, ItemOneUp, ItemRocket, ItemShield,
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,41 @@
|
|||||||
|
package de.teamteamteam.spacescooter.entity.obstacle;
|
||||||
|
|
||||||
|
public abstract class MovingObstacle extends Obstacle {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delta the Obstacle moves at on X-Axis.
|
||||||
|
* Defaults to -1.
|
||||||
|
*/
|
||||||
|
private int xDelta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delta the Obstacle moves at on Y-Axis.
|
||||||
|
* Defaults to 0.
|
||||||
|
*/
|
||||||
|
private int yDelta;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor.
|
||||||
|
*/
|
||||||
|
public MovingObstacle(int x, int y) {
|
||||||
|
super(x, y);
|
||||||
|
this.setMoveDeltas(-1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Make the Obstacle move at its defined X- and Y-Delta.
|
||||||
|
*/
|
||||||
|
public void update() {
|
||||||
|
this.transpose(this.xDelta, this.yDelta);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the deltas used to move this Obstacle.
|
||||||
|
*/
|
||||||
|
public void setMoveDeltas(int xDelta, int yDelta) {
|
||||||
|
this.xDelta = xDelta;
|
||||||
|
this.yDelta = yDelta;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package de.teamteamteam.spacescooter.entity.obstacle;
|
package de.teamteamteam.spacescooter.entity.obstacle;
|
||||||
|
|
||||||
import de.teamteamteam.spacescooter.entity.CollidableEntity;
|
import de.teamteamteam.spacescooter.entity.CollidableEntity;
|
||||||
|
import de.teamteamteam.spacescooter.entity.spi.Collidable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obstacles are static or floating things that do damage on collision.
|
* Obstacles are static or floating things that do damage on collision.
|
||||||
@ -11,4 +12,13 @@ public abstract class Obstacle extends CollidableEntity {
|
|||||||
super(x, y);
|
super(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Obstacles do not care about collisions. Mostly.
|
||||||
|
* Override this if you think different.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void collideWith(Collidable entity) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
package de.teamteamteam.spacescooter.entity.obstacle;
|
package de.teamteamteam.spacescooter.entity.obstacle;
|
||||||
|
|
||||||
import de.teamteamteam.spacescooter.entity.spi.Collidable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First proof of concept obstacle.
|
* The first stone/meteor like object in the game!
|
||||||
* A simple stone that moves to the left.
|
|
||||||
*/
|
*/
|
||||||
public class StoneOne extends Obstacle {
|
public class StoneOne extends MovingObstacle {
|
||||||
|
|
||||||
public StoneOne(int x, int y) {
|
public StoneOne(int x, int y) {
|
||||||
super(x, y);
|
super(x, y);
|
||||||
@ -14,13 +11,4 @@ public class StoneOne extends Obstacle {
|
|||||||
this.setCollisionDamage(9001);
|
this.setCollisionDamage(9001);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update() {
|
|
||||||
this.transpose(-1, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void collideWith(Collidable entity) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
package de.teamteamteam.spacescooter.entity.obstacle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yet another stony obstacle.
|
||||||
|
*/
|
||||||
|
public class StoneThree extends MovingObstacle {
|
||||||
|
|
||||||
|
public StoneThree(int x, int y) {
|
||||||
|
super(x, y);
|
||||||
|
this.setImage("images/stones/stone03.png");
|
||||||
|
this.setCollisionDamage(9001);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package de.teamteamteam.spacescooter.entity.obstacle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Yet another stony obstacle.
|
||||||
|
*/
|
||||||
|
public class StoneTwo extends MovingObstacle {
|
||||||
|
|
||||||
|
public StoneTwo(int x, int y) {
|
||||||
|
super(x, y);
|
||||||
|
this.setImage("images/stones/stone02.png");
|
||||||
|
this.setCollisionDamage(9001);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -11,6 +11,8 @@ import de.teamteamteam.spacescooter.entity.enemy.EnemyOne;
|
|||||||
import de.teamteamteam.spacescooter.entity.enemy.EnemyThree;
|
import de.teamteamteam.spacescooter.entity.enemy.EnemyThree;
|
||||||
import de.teamteamteam.spacescooter.entity.enemy.EnemyTwo;
|
import de.teamteamteam.spacescooter.entity.enemy.EnemyTwo;
|
||||||
import de.teamteamteam.spacescooter.entity.obstacle.StoneOne;
|
import de.teamteamteam.spacescooter.entity.obstacle.StoneOne;
|
||||||
|
import de.teamteamteam.spacescooter.entity.obstacle.StoneThree;
|
||||||
|
import de.teamteamteam.spacescooter.entity.obstacle.StoneTwo;
|
||||||
import de.teamteamteam.spacescooter.screen.GameScreen;
|
import de.teamteamteam.spacescooter.screen.GameScreen;
|
||||||
import de.teamteamteam.spacescooter.sound.SoundSystem;
|
import de.teamteamteam.spacescooter.sound.SoundSystem;
|
||||||
import de.teamteamteam.spacescooter.utility.Loader;
|
import de.teamteamteam.spacescooter.utility.Loader;
|
||||||
@ -189,6 +191,12 @@ public final class Level {
|
|||||||
case StoneOne:
|
case StoneOne:
|
||||||
new StoneOne(x, y);
|
new StoneOne(x, y);
|
||||||
break;
|
break;
|
||||||
|
case StoneTwo:
|
||||||
|
new StoneTwo(x, y);
|
||||||
|
break;
|
||||||
|
case StoneThree:
|
||||||
|
new StoneThree(x, y);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
System.err.println("I don't know how to spawn this: " + entity);
|
System.err.println("I don't know how to spawn this: " + entity);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user