created destructible tiles
This commit is contained in:
@@ -8,6 +8,7 @@ import de.miaurizius.jgame2d.core.handlers.KeyHandler;
|
||||
import de.miaurizius.jgame2d.entity.item.ShieldWoodObj;
|
||||
import de.miaurizius.jgame2d.entity.item.SwordNormalObj;
|
||||
import de.miaurizius.jgame2d.entity.projectile.FireballObj;
|
||||
import de.miaurizius.jgame2d.tile.interactive.InteractiveTile;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -79,6 +80,9 @@ public class Player extends Entity {
|
||||
int monsterIndex = panel.collisionH.checkEntity(this, panel.monster);
|
||||
interactMonster(monsterIndex);
|
||||
|
||||
// CHECK INTERACTIVE TILE COLLISION
|
||||
int iTileIndex = panel.collisionH.checkEntity(this, panel.iTile);
|
||||
|
||||
// CHECK EVENT
|
||||
panel.eventH.checkEvent();
|
||||
|
||||
@@ -181,6 +185,9 @@ public class Player extends Entity {
|
||||
int monsterIndex = panel.collisionH.checkEntity(this, panel.monster);
|
||||
damageMonster(monsterIndex, attack);
|
||||
|
||||
int iTileIndex = panel.collisionH.checkEntity(this, panel.iTile);
|
||||
interactTile(iTileIndex);
|
||||
|
||||
worldX = currentWorldX;
|
||||
worldY = currentWorldY;
|
||||
solidArea.width = solidAreaWidth;
|
||||
@@ -213,6 +220,10 @@ public class Player extends Entity {
|
||||
checkLevelUp();
|
||||
}
|
||||
}
|
||||
public void interactTile(int index) {
|
||||
if(index == 999 || !panel.iTile[index].destructible) return;
|
||||
panel.iTile[index] = null;
|
||||
}
|
||||
|
||||
public void interactNPC(int index) {
|
||||
if(index == 999) return;
|
||||
|
||||
Reference in New Issue
Block a user