package raiding.state;
import java.util.ArrayList;
import java.util.List;
import org.newdawn.slick.Animation;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.SpriteSheet;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;
import raiding.engine.model.PlayerStatus;
public class PlayState extends BasicGameState {
int stateID = -1;
private List<PlayerStatus> players = new ArrayList<PlayerStatus>();
private PlayerStatus selfStatus;
public PlayState(int stateID) {
this.stateID = stateID;
}
@Override
public int getID() {
return stateID;
}
@Override
public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {
SpriteSheet sheet = new SpriteSheet("data/corphish.png", 60, 60);
Animation anim = new Animation(sheet, 300);
players.add(new PlayerStatus("player1",anim, 30, 30));
selfStatus = players.get(0);
}
@Override
public void render(GameContainer arg0, StateBasedGame arg1, Graphics arg2) throws SlickException {
for (PlayerStatus player : players)
player.draw();
}
@Override
public void update(GameContainer gc, StateBasedGame arg1, int delta) throws SlickException {
selfStatus.update(gc, delta);
}
}