@Override public void update(GameContainer container, int delta) { Input input = container.getInput(); // move player if (input.isKeyDown(Input.KEY_W)) { // if(input.isKeyDown(Input.KEY_A)){ // setDirection(Direction.NORTHWEST); // } else if(input.isKeyDown(Input.KEY_D)){ // setDirection(Direction.NORTHEAST); // } else { setDirection(Direction.NORTH); // } } else if (input.isKeyDown(Input.KEY_S)) { // if(input.isKeyDown(Input.KEY_A)){ // setDirection(Direction.SOUTHWEST); // } else if(input.isKeyDown(Input.KEY_D)){ // setDirection(Direction.SOUTHEAST); // } else { setDirection(Direction.SOUTH); // } } else if (input.isKeyDown(Input.KEY_A)) { setDirection(Direction.WEST); } else if (input.isKeyDown(Input.KEY_D)) { setDirection(Direction.EAST); } else { setDirection(Direction.STOP); } if (input.isKeyPressed(Input.KEY_SPACE)) { // float x = getPosition().x + (getImage().getWidth() / 2); // float y = getPosition().y + (getImage().getHeight() / 2); // currentWeapon.activate(new Vector2f(x, y)); currentWeapon.activate(getPosition().copy()); } move(delta); Vector2f pos = getPosition(); pos.x = Math.max(0, pos.x); pos.x = Math.min(container.getWidth(), pos.x); pos.y = Math.max(0, pos.y); pos.y = Math.min(container.getHeight(), pos.y); }