added collision for monsters (and made test world-setup)

This commit is contained in:
2025-11-29 00:08:42 +01:00
parent 71dc34b418
commit d07077a5f1
4 changed files with 52 additions and 84 deletions

View File

@@ -59,6 +59,8 @@ public class Entity {
collisionOn = false;
panel.collisionH.checkTile(this);
panel.collisionH.checkObject(this, false);
panel.collisionH.checkEntity(this, panel.npc);
panel.collisionH.checkEntity(this, panel.monster);
panel.collisionH.checkPlayer(this);
if(!collisionOn) {

View File

@@ -34,8 +34,10 @@ public class Player extends Entity {
}
public void setDefaultValues() {
worldX = panel.tileSize * 23;
worldY = panel.tileSize * 21;
// worldX = panel.tileSize * 23;
// worldY = panel.tileSize * 21;
worldX = panel.tileSize * 10;
worldY = panel.tileSize * 13;
speed = 4;
direction = Direction.DOWN;
@@ -75,6 +77,9 @@ public class Player extends Entity {
int npcIndex = panel.collisionH.checkEntity(this, panel.npc);
interactNPC(npcIndex);
// CHECK MONSTER COLLISION
int monsterIndex = panel.collisionH.checkEntity(this, panel.monster);
// CHECK EVENT
panel.eventH.checkEvent();