player can now choose between different shields and weapons. added consumable items (healing potion)
This commit is contained in:
@@ -175,6 +175,12 @@ public class UI {
|
||||
|
||||
// DRAW PLAYER ITEMS
|
||||
for(int i = 0; i < panel.player.inventory.size(); i++) {
|
||||
|
||||
// EQUIP CURSOR
|
||||
if(panel.player.inventory.get(i) == panel.player.currentWeapon || panel.player.inventory.get(i) == panel.player.currentShield) {
|
||||
graphics2d.setColor(new Color(240, 190,90));
|
||||
graphics2d.fillRoundRect(slotX, slotY, panel.tileSize, panel.tileSize, 10, 10);
|
||||
}
|
||||
graphics2d.drawImage(panel.player.inventory.get(i).down1, slotX, slotY, null);
|
||||
slotX += slotSize;
|
||||
if (i == 4 || i == 9 || i == 14) {
|
||||
@@ -230,7 +236,7 @@ public class UI {
|
||||
int height = panel.tileSize*4;
|
||||
drawSubWindow(x, y, width, height);
|
||||
|
||||
graphics2d.setFont(graphics2d.getFont().deriveFont(Font.PLAIN, 28F));
|
||||
graphics2d.setFont(graphics2d.getFont().deriveFont(Font.PLAIN, 30F));
|
||||
x += panel.tileSize;
|
||||
y += panel.tileSize;
|
||||
|
||||
@@ -300,12 +306,12 @@ public class UI {
|
||||
public int getAlignedToRightX(String text, int tailX) {
|
||||
return tailX - (int) graphics2d.getFontMetrics().getStringBounds(text, graphics2d).getWidth();
|
||||
}
|
||||
public int getItemIndex() {
|
||||
return slotCol + slotRow*5;
|
||||
}
|
||||
public void addMessage(String text) {
|
||||
messages.add(text);
|
||||
messageCounter.add(0);
|
||||
}
|
||||
public int getItemIndex() {
|
||||
return slotCol + slotRow*5;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,13 @@ public enum EntityType {
|
||||
NPC,
|
||||
MONSTER,
|
||||
ITEM,
|
||||
WORLD
|
||||
WORLD,
|
||||
WEAPON,
|
||||
SHIELD;
|
||||
|
||||
public enum WeaponType {
|
||||
SWORD,
|
||||
AXE
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package de.miaurizius.jgame2d.core.handlers;
|
||||
|
||||
import de.miaurizius.jgame2d.core.GamePanel;
|
||||
import de.miaurizius.jgame2d.entity.item.AxeObj;
|
||||
import de.miaurizius.jgame2d.entity.item.IronShieldObj;
|
||||
import de.miaurizius.jgame2d.entity.item.KeyObj;
|
||||
import de.miaurizius.jgame2d.entity.item.PotionObj;
|
||||
import de.miaurizius.jgame2d.entity.npc.OldManNPC;
|
||||
import de.miaurizius.jgame2d.entity.monster.GreenSlimeMON;
|
||||
|
||||
@@ -25,10 +28,20 @@ public class AssetSetter {
|
||||
panel.obj[i].worldY = panel.tileSize*19;
|
||||
i++;
|
||||
|
||||
panel.obj[i] = new KeyObj(panel);
|
||||
panel.obj[i].worldX = panel.tileSize*26;
|
||||
panel.obj[i] = new AxeObj(panel);
|
||||
panel.obj[i].worldX = panel.tileSize*33;
|
||||
panel.obj[i].worldY = panel.tileSize*21;
|
||||
i++;
|
||||
|
||||
panel.obj[i] = new IronShieldObj(panel);
|
||||
panel.obj[i].worldX = panel.tileSize*35;
|
||||
panel.obj[i].worldY = panel.tileSize*21;
|
||||
i++;
|
||||
|
||||
panel.obj[i] = new PotionObj(panel);
|
||||
panel.obj[i].worldX = panel.tileSize*22;
|
||||
panel.obj[i].worldY = panel.tileSize*27;
|
||||
i++;
|
||||
}
|
||||
|
||||
public void setNPC() {
|
||||
|
||||
@@ -95,8 +95,12 @@ public class KeyHandler implements KeyListener {
|
||||
panel.ui.slotCol++;
|
||||
panel.playSE(9);
|
||||
break;
|
||||
|
||||
case KeyEvent.VK_SPACE:
|
||||
panel.player.selectItem();
|
||||
break;
|
||||
// EXIT STATE
|
||||
case KeyEvent.VK_C:
|
||||
case KeyEvent.VK_C, KeyEvent.VK_ESCAPE:
|
||||
panel.gameState = GameState.PLAY;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user