import processing.core.PApplet; /** * A Character we can talk to. */ public class Talkable extends Character implements Interactable{ Bubble bubble; boolean healme = false; Talkable (Fenster window, String type, int color, boolean collidable, Bubble bubble) { super(window, type, color, collidable); this.bubble = bubble; } Talkable (Fenster window, String type, int color, boolean collidable, Bubble bubble, boolean healme) { super(window, type, color, collidable); this.bubble = bubble; this.healme = healme; } Talkable(Talkable another) { super(another); } public Talkable(Fenster window) { super(window); } public void interact() { if(!this.bubble.toggle()) { if (healme) { window.player.heal(20); window.healEffect.play(); } } } public void draw() { window.fill(color); window.text(type, this.pos.get().x, this.pos.get().y); this.bubble.draw(this.pos.get_grid().x, this.pos.get_grid().y, 20); if (Math.abs(window.player.pos.get_grid().x - this.pos.get_grid().x) > 1 || Math.abs(window.player.pos.get_grid().y - this.pos.get_grid().y) > 1) { this.bubble.close(); } } }