public void OnDeath() { try { texture = ImageIO.read( getClass().getClassLoader().getResourceAsStream("Assets/gfx/raumschiff_kaputt.png")); } catch (IOException e) { GameConsole.Print("ERROR", "Failed to load dead player texture:"); e.printStackTrace(); } return; }
public Player(Game game, int x, int y) { this.game = game; this.sps = 3f; // By default: 3 shots per second (will increase with higher level :D this.maxRange = 300f; this.shotDelay = (1 / sps) * 1000; this.timeSinceLastShot = 0; try { texture = ImageIO.read( getClass().getClassLoader().getResourceAsStream("Assets/gfx/raumschiffchen.png")); } catch (IOException e) { GameConsole.Print("ERROR", "Failed to load player texture:"); e.printStackTrace(); } this.size = new vec2(texture.getWidth(), texture.getHeight()); this.bounding = new Rectangle(x, y, size.x, size.y); this.pos = new vec2f(x, y); this.health = 10; this.score = 0; }
public void OnKill() { score++; setFlySpeed(getFlySpeed() + 0.0002f * score); maxRange += 5f; GameConsole.Print("GameEvent", "Killed an enemy, new score is: " + score); }
public void giveDamage() { if (--health <= 0) die(); GameConsole.Print("GameInfo", "Player got damage! Remaining health: " + health); }