48 lines
1.1 KiB
Java
48 lines
1.1 KiB
Java
package ei.game.gamestate;
|
|
|
|
import ei.engine.effects.Particles;
|
|
import ei.engine.math.Vector2f;
|
|
import ei.engine.scene.Node;
|
|
import ei.engine.scene.Sprite;
|
|
import ei.engine.sound.Sound;
|
|
import ei.engine.state.GameState;
|
|
|
|
|
|
public class InGameState extends GameState{
|
|
private Node rootNode;
|
|
private Sprite sprite1;
|
|
private Sound sound1;
|
|
private Particles p;
|
|
|
|
public InGameState(String name){
|
|
super(name);
|
|
rootNode = new Node("InGameNode");
|
|
|
|
sprite1 = new Sprite("tank","data/units/tank.png");
|
|
//sprite1.setScale(new Vector2f(0.5f,0.5f));
|
|
//sprite1.setLocation(new Vector2f(300,300));
|
|
rootNode.add(sprite1);
|
|
|
|
p = new Particles("particle");
|
|
p.setLocation(sprite1.getLocation());
|
|
rootNode.add(p);
|
|
|
|
sound1 = new Sound("sound","data/sounds/test.wav");
|
|
sound1.play();
|
|
rootNode.add(sound1);
|
|
}
|
|
|
|
@Override
|
|
public void render() {
|
|
rootNode.render();
|
|
}
|
|
|
|
@Override
|
|
public void update() {
|
|
sprite1.getLocation().add(new Vector2f(0.5f,0.5f));
|
|
sprite1.getRotation().add(0, 0, 0.5f);
|
|
sound1.getLocation().add(new Vector2f(1,0));
|
|
rootNode.update();
|
|
}
|
|
|
|
}
|