Add tower sprites
This commit is contained in:
parent
6ebc761ee3
commit
7200c3e5e4
|
@ -2,11 +2,16 @@ package fr.ynerant.leveleditor.game;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
public class SuperTower extends Tower {
|
||||
public SuperTower(int x, int y) {
|
||||
public class AutoTower extends Tower {
|
||||
public AutoTower(int x, int y) {
|
||||
super(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "autotower";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamagePerShot() {
|
||||
return 20;
|
|
@ -9,6 +9,11 @@ public class BasicTower extends Tower {
|
|||
super(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "basictower";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamagePerShot() {
|
||||
return 1;
|
||||
|
|
|
@ -168,8 +168,8 @@ public class GameFrame extends JFrame {
|
|||
}
|
||||
|
||||
for (Tower tower : towers) {
|
||||
g.setColor(Color.blue);
|
||||
g.fillRect(SPRITE_SIZE * tower.getX(), SPRITE_SIZE * tower.getY(), SPRITE_SIZE, SPRITE_SIZE);
|
||||
Sprite s = tower.getSprite();
|
||||
g.drawImage(s.getImage(), SPRITE_SIZE * tower.getX(), SPRITE_SIZE * tower.getY(), SPRITE_SIZE, SPRITE_SIZE, null, null);
|
||||
}
|
||||
|
||||
repaint();
|
||||
|
|
|
@ -8,6 +8,11 @@ public class NullTower extends Tower {
|
|||
super(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "nulltower";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDamagePerShot() {
|
||||
return Integer.MAX_VALUE;
|
||||
|
|
|
@ -1,21 +1,32 @@
|
|||
package fr.ynerant.leveleditor.game;
|
||||
|
||||
import fr.ynerant.leveleditor.api.editor.sprites.Sprite;
|
||||
import fr.ynerant.leveleditor.api.editor.sprites.SpriteRegister;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class Tower {
|
||||
private Sprite sprite;
|
||||
private final int x;
|
||||
private final int y;
|
||||
private long remainingTicks;
|
||||
|
||||
public Tower(int x, int y) {
|
||||
this.sprite = SpriteRegister.getCategory(getName()).getSprites().get(0);
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
public Sprite getSprite() {
|
||||
return sprite;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract int getDamagePerShot();
|
||||
|
||||
public abstract long getPeriod();
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 696 B |
Binary file not shown.
After Width: | Height: | Size: 697 B |
Binary file not shown.
After Width: | Height: | Size: 697 B |
|
@ -327,5 +327,14 @@
|
|||
],
|
||||
"mobcancer": [
|
||||
[0, 0]
|
||||
],
|
||||
"simpletower": [
|
||||
[0, 0]
|
||||
],
|
||||
"nulltower": [
|
||||
[0, 0]
|
||||
],
|
||||
"autotower": [
|
||||
[0, 0]
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue