farma updejt

This commit is contained in:
2025-12-08 01:39:39 +01:00
parent 9c61c3b56d
commit e49f567831
12 changed files with 596 additions and 99 deletions

View File

@@ -15,7 +15,8 @@ class UIScene extends Phaser.Scene {
this.overlayGraphics = this.add.graphics();
this.overlayGraphics.setDepth(-1000); // Behind UI elements
this.createStatusBars();
this.drawUI();
this.createInventoryBar();
this.createGoldDisplay();
this.createVirtualJoystick();
@@ -176,36 +177,37 @@ class UIScene extends Phaser.Scene {
}
}
createStatusBars() {
drawUI() {
const x = 20;
const y = 20;
const width = 200;
const height = 20;
const width = 150; // Zmanjšana širina (300 -> 150)
const height = 15; // Zmanjšana višina (30 -> 15)
const padding = 10;
// Style
const boxStyle = {
fillStyle: { color: 0x000000, alpha: 0.5 },
lineStyle: { width: 2, color: 0xffffff, alpha: 0.8 }
};
// 1. Health Bar
this.add.text(x, y - 5, 'HP', { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
this.healthBar = this.createBar(x + 30, y, width, height, 0xff0000);
this.setBarValue(this.healthBar, 100);
this.healthBar = this.drawBar(x, y, width, height, 0xff0000, 100, 'HP');
// 2. Hunger Bar
this.add.text(x, y + height + padding - 5, 'HUN', { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
this.hungerBar = this.createBar(x + 30, y + height + padding, width, height, 0xff8800);
this.setBarValue(this.hungerBar, 80);
this.hungerBar = this.drawBar(x, y + height + padding, width, height, 0xff8800, 80, 'HUN');
// 3. Thirst Bar
this.add.text(x, y + (height + padding) * 2 - 5, 'H2O', { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
this.thirstBar = this.createBar(x + 30, y + (height + padding) * 2, width, height, 0x0088ff);
this.setBarValue(this.thirstBar, 90);
this.thirstBar = this.drawBar(x, y + (height + padding) * 2, width, height, 0x0088ff, 90, 'H2O');
// 4. XP Bar
this.XPBar = this.drawBar(x, y + (height + padding) * 3, width, height, 0xFFD700, 0, 'XP');
// 5. Level Display
this.LevelDisplay = this.add.text(x, y + (height + padding) * 4, 'LV: 1', {
fontSize: '18px', fontFamily: 'Courier New', fill: '#FFD700', fontStyle: 'bold'
});
}
createBar(x, y, width, height, color) {
drawBar(x, y, width, height, color, initialPercent = 100, label = '') {
// Label
if (label) {
this.add.text(x, y - 12, label, { fontSize: '12px', fontFamily: 'Courier New', fill: '#ffffff' });
}
// Background
const bg = this.add.graphics();
bg.fillStyle(0x000000, 0.5);
@@ -215,8 +217,11 @@ class UIScene extends Phaser.Scene {
// Fill
const fill = this.add.graphics();
// Initial draw
fill.fillStyle(color, 1);
fill.fillRect(x + 2, y + 2, width - 4, height - 4);
const maxWidth = width - 4;
const currentWidth = (maxWidth * initialPercent) / 100;
fill.fillRect(x + 2, y + 2, currentWidth, height - 4);
return { bg, fill, x, y, width, height, color };
}