Fixed with nodes and selection
This commit is contained in:
parent
c1e3fcdf9e
commit
1cb10a3166
5 changed files with 75 additions and 29 deletions
|
|
@ -1,18 +1,34 @@
|
|||
package ei.game.scene.units;
|
||||
|
||||
import ei.engine.math.Vector2f;
|
||||
import ei.engine.math.Vector4f;
|
||||
import ei.engine.scene.Box;
|
||||
import ei.engine.scene.Entity;
|
||||
import ei.engine.scene.Sprite;
|
||||
import ei.engine.texture.Texture;
|
||||
|
||||
public class Tank extends Unit{
|
||||
private Box box;
|
||||
public Tank() {
|
||||
this(0, 0);
|
||||
}
|
||||
|
||||
public Tank(int x, int y){
|
||||
super(10);
|
||||
setSprite(new Sprite("Tank", "data/units/tank.png"));
|
||||
getSprite().setSize(new Vector2f(50,37));
|
||||
Sprite sp = new Sprite("Tank", "data/units/tank.png");
|
||||
sp.setSize(new Vector2f(50,37));
|
||||
getNode().add(sp);
|
||||
|
||||
Texture tex = new Texture();
|
||||
tex.setColor(new Vector4f(0.5f, 1.0f, 0.5f,1));
|
||||
box = new Box("selectionBox",tex);
|
||||
box.setSize(new Vector2f(40,40));
|
||||
|
||||
}
|
||||
|
||||
protected Entity getSelection() {
|
||||
|
||||
return box;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue