open NPC dialogue if you collide with it

This commit is contained in:
2025-11-28 19:54:30 +01:00
parent 61a51f184c
commit dada9e4f2f
6 changed files with 85 additions and 16 deletions

View File

@@ -2,10 +2,10 @@ package de.miaurizius.jgame2d.entity;
import de.miaurizius.jgame2d.core.*;
import de.miaurizius.jgame2d.core.enums.Direction;
import de.miaurizius.jgame2d.core.enums.GameState;
import de.miaurizius.jgame2d.core.handlers.KeyHandler;
import java.awt.*;
import java.awt.image.BufferedImage;
public class Player extends Entity {
@@ -91,12 +91,12 @@ public class Player extends Entity {
public void pickObject(int index) {
if(index == 999) return;
}
public void interactNPC(int index) {
if(index == 999) return;
System.out.println("npc collision detected");
panel.gameState = GameState.DIALOGUE;
panel.npc[index].speak();
}
public void draw(Graphics2D graphics2d) {