diff --git a/docs/CAMERA_FIX.md b/docs/CAMERA_FIX.md new file mode 100644 index 0000000..741f66c --- /dev/null +++ b/docs/CAMERA_FIX.md @@ -0,0 +1,50 @@ +# ๐ŸŽฎ CAMERA FIX - Better View! + +**Date**: December 13, 2025, 01:16 + +--- + +## โœ… CHANGES MADE + +### **Resolution Increased** +- **Before**: 640x360 (too small, too zoomed in) +- **After**: 1024x768 (much better view!) + +### **Aspect Ratio** +- **Before**: 16:9 (640x360) +- **After**: 4:3 (1024x768) + +--- + +## ๐ŸŽจ RESULT + +### **Before:** +- Too zoomed in โŒ +- Hard to see terrain โŒ +- Cramped view โŒ + +### **After:** +- Perfect zoom level โœ… +- See more terrain โœ… +- Comfortable view โœ… + +--- + +## ๐Ÿ“Š TECHNICAL DETAILS + +### **New Resolution:** +- Width: 1024px (was 640px) +- Height: 768px (was 360px) +- Aspect: 4:3 (was 16:9) + +### **Benefits:** +- 60% more screen space +- Better for isometric view +- More comfortable gameplay +- See more of your farm! + +--- + +**Osveลพi igro s F5 da vidiลก spremembe!** ๐Ÿ”„ + +*Fixed: December 13, 2025, 01:16* diff --git a/docs/CENTRAL_POPUP_GUIDE.md b/docs/CENTRAL_POPUP_GUIDE.md new file mode 100644 index 0000000..20a466a --- /dev/null +++ b/docs/CENTRAL_POPUP_GUIDE.md @@ -0,0 +1,192 @@ +# ๐Ÿ“‹ CENTRAL POPUP SYSTEM - Complete Guide + +**Date**: December 13, 2025, 01:09 + +--- + +## โœ… WHAT IT DOES + +### **Central Popups** +- Appears in **CENTER** of screen +- Always **in front** of player +- Pauses game (optional) +- Easy to read and interact +- Beautiful animations + +### **Types of Popups** +1. **Quest** - Quest dialogs (๐Ÿ“œ) +2. **Story** - Story moments (๐Ÿ“–) +3. **Info** - Information (โ„น๏ธ) +4. **Success** - Success messages (โœ…) +5. **Warning** - Warnings (โš ๏ธ) +6. **Error** - Errors (โŒ) + +--- + +## ๐ŸŽฎ HOW TO USE + +### **Show Quest:** +```javascript +scene.centralPopup.showQuest( + 'First Harvest', + 'Plant and harvest your first crops!', + ['Plant 5 seeds', 'Water them', 'Harvest when ready'] +); +``` + +### **Show Story:** +```javascript +scene.centralPopup.showStory( + 'Welcome to NovaFarma', + 'You arrive at an abandoned farm. Time to rebuild!', + 'farm_image' // optional image +); +``` + +### **Show Notification:** +```javascript +scene.centralPopup.showNotification('Quest completed!', 'success'); +scene.centralPopup.showNotification('Low health!', 'warning'); +``` + +### **Custom Popup:** +```javascript +scene.centralPopup.showPopup({ + title: 'Custom Title', + message: 'Your message here', + type: 'info', + icon: '๐ŸŽ‰', + buttons: [ + { text: 'Yes', callback: () => console.log('Yes!') }, + { text: 'No', action: 'close' } + ], + autoClose: false +}); +``` + +--- + +## ๐ŸŽจ FEATURES + +### **Automatic Positioning** +- Always centered on screen +- Responsive to screen size +- Scrolls with camera + +### **Beautiful Design** +- Rounded corners +- Colored borders (based on type) +- Smooth animations +- Dark overlay behind + +### **Interactive** +- Multiple buttons +- Hover effects +- Click handlers +- Auto-close option + +### **Game Integration** +- Pauses game (optional) +- Sound effects +- Queue system (multiple popups) +- Priority levels + +--- + +## ๐Ÿ“Š POPUP TYPES & COLORS + +| Type | Color | Border | Icon | Use For | +|------|-------|--------|------|---------| +| Quest | Brown | Gold | ๐Ÿ“œ | Quests, missions | +| Story | Dark Blue | Purple | ๐Ÿ“– | Story moments | +| Info | Dark Gray | Gray | โ„น๏ธ | Information | +| Success | Dark Green | Green | โœ… | Achievements | +| Warning | Dark Red | Red | โš ๏ธ | Warnings | +| Error | Dark Red | Red | โŒ | Errors | + +--- + +## ๐Ÿ”ง SETTINGS + +### **Enable/Disable:** +```javascript +scene.centralPopup.settings.enabled = false; // Disable +``` + +### **Auto-Close:** +```javascript +scene.centralPopup.settings.autoClose = true; +scene.centralPopup.settings.autoCloseDelay = 5000; // 5 seconds +``` + +### **Pause Game:** +```javascript +scene.centralPopup.settings.pauseGameOnPopup = true; +``` + +### **Sound:** +```javascript +scene.centralPopup.settings.soundOnPopup = true; +``` + +--- + +## ๐Ÿ’ก EXAMPLES + +### **Quest Accept/Decline:** +```javascript +scene.centralPopup.showPopup({ + title: 'New Quest Available', + message: 'Help the farmer harvest crops!', + type: 'quest', + icon: '๐Ÿ“œ', + buttons: [ + { + text: 'Accept', + callback: () => { + // Start quest + scene.questSystem.startQuest('harvest_quest'); + } + }, + { text: 'Decline', action: 'close' } + ], + autoClose: false +}); +``` + +### **Story Cutscene:** +```javascript +scene.centralPopup.showStory( + 'Day 1', + 'The sun rises over your new farm. Time to get to work!', + 'sunrise_image' +); +``` + +### **Achievement:** +```javascript +scene.centralPopup.showNotification( + 'Achievement Unlocked: First Harvest!', + 'success' +); +``` + +--- + +## ๐ŸŽ‰ RESULT + +**Perfect for:** +- โœ… Quest dialogs +- โœ… Story moments +- โœ… Important notifications +- โœ… Achievements +- โœ… Warnings +- โœ… Any message that needs attention! + +**Always visible, always centered, always beautiful!** ๐Ÿ“‹โœจ + +--- + +**Osveลพi igro s F5 da vidiลก!** ๐Ÿ”„ + +*Created: December 13, 2025, 01:09* diff --git a/docs/EPILEPSY_WARNING_FIX.md b/docs/EPILEPSY_WARNING_FIX.md new file mode 100644 index 0000000..30a488e --- /dev/null +++ b/docs/EPILEPSY_WARNING_FIX.md @@ -0,0 +1,70 @@ +# โœ… EPILEPSY WARNING - FIXED! + +**Date**: December 13, 2025, 01:21 + +--- + +## ๐Ÿ”ง CHANGES MADE + +### **1. Positioning Fixed** +- **Before**: Used `cameras.main.centerX/Y` (wrong!) +- **After**: Uses `scale.width/2` and `scale.height/2` (correct!) + +### **2. Depth Increased** +- **Before**: `setDepth(10000)` (behind trees) +- **After**: `setDepth(99999)` (ALWAYS ON TOP!) + +### **3. Better Design** +- Larger (700x500 instead of 600x400) +- Red border +- Bigger text +- Hover effects on buttons + +### **4. Buttons Work** +- โœ… "ENABLE PROTECTION" - enables photosensitivity mode +- โœ… "CONTINUE WITHOUT" - continues without protection +- โœ… Hover effects (scale 1.1) +- โœ… Proper click handlers + +--- + +## ๐ŸŽจ NEW DESIGN + +### **Size:** +- 700x500px (was 600x400px) +- Red border (4px) +- 98% opacity black background + +### **Title:** +- 36px (was 32px) +- Red color +- Black stroke + +### **Buttons:** +- Larger padding +- Hover effects +- Bold text +- Better colors + +--- + +## โœ… RESULT + +### **Before:** +- Behind trees โŒ +- Wrong position โŒ +- Small โŒ +- No hover effects โŒ + +### **After:** +- Always on top โœ… +- Centered โœ… +- Larger โœ… +- Hover effects โœ… +- Buttons work โœ… + +--- + +**Osveลพi igro s F5 da vidiลก!** ๐Ÿ”„ + +*Fixed: December 13, 2025, 01:21* diff --git a/docs/EQUIPMENT_PANEL_FIX.md b/docs/EQUIPMENT_PANEL_FIX.md new file mode 100644 index 0000000..1878ca0 --- /dev/null +++ b/docs/EQUIPMENT_PANEL_FIX.md @@ -0,0 +1,64 @@ +# โœ… EQUIPMENT PANEL - FIXED! + +**Date**: December 13, 2025, 01:23 + +--- + +## ๐Ÿ”ง CHANGES MADE + +### **1. Size Reduced** +- **Before**: 80x80px (too big!) +- **After**: 60x60px (smaller, cleaner) + +### **2. Position Moved** +- **Before**: Y=150 (blocking view) +- **After**: Y=400 (lower, out of way) + +### **3. Farm Theme Colors** +- **Before**: Black (0x000000) +- **After**: Brown wood (0x4a3520) +- Added brown border + +### **4. Text Simplified** +- **Before**: "EQUIPPED" + tool name +- **After**: "TOOL" only (name hidden) + +--- + +## ๐ŸŽจ NEW DESIGN + +### **Size:** +- 60x60px (was 80x80px) +- 25% smaller! + +### **Colors:** +- Background: Brown wood +- Border: Saddle brown +- Label: Gold + +### **Position:** +- Left side +- Y=400 (lower) +- Doesn't block HP bars + +--- + +## โœ… RESULT + +### **Before:** +- Too big โŒ +- Blocking view โŒ +- Black color โŒ +- Too much text โŒ + +### **After:** +- Smaller โœ… +- Out of way โœ… +- Farm colors โœ… +- Simple โœ… + +--- + +**Osveลพi igro s F5 da vidiลก!** ๐Ÿ”„ + +*Fixed: December 13, 2025, 01:23* diff --git a/docs/KAKO_OSVEZITI.md b/docs/KAKO_OSVEZITI.md new file mode 100644 index 0000000..a77d0ae --- /dev/null +++ b/docs/KAKO_OSVEZITI.md @@ -0,0 +1,53 @@ +# ๐Ÿ”„ KAKO OSVEลฝITI IGRO + +**Namesto restarta aplikacije, samo osveลพi!** + +--- + +## ๐ŸŽฎ HITRI NAฤŒIN + +### **Windows/Linux:** +- Pritisni **F5** ali **Ctrl + R** + +### **macOS:** +- Pritisni **Cmd + R** + +--- + +## ๐Ÿ’ก KDAJ OSVEลฝITI? + +### **Po Spremembah Kode:** +1. Shrani datoteko +2. Pritisni **F5** v igri +3. Igra se ponovno naloลพi + +### **Po Napakah:** +1. Pritisni **F5** +2. Preveri konzolo (F12) + +--- + +## ๐Ÿš€ HITRI RELOAD + +**Electron** podpira **hot reload**: +- Spremeni kodo +- Shrani +- Pritisni **F5** +- Igra se osveลพi! + +--- + +## โš ๏ธ KDAJ RESTART? + +**Restart aplikacije potrebujeลก SAMO ฤe:** +- Spreminjaลก `package.json` +- Dodajaลก nove npm pakete +- Spreminjaลก Electron konfiguraciju + +**Sicer samo F5!** โœ… + +--- + +**HITRO IN ENOSTAVNO!** ๐ŸŽ‰ + +*Samo F5 namesto celotnega restarta!* diff --git a/docs/KEYBOARD_SHORTCUTS.md b/docs/KEYBOARD_SHORTCUTS.md new file mode 100644 index 0000000..4ae2617 --- /dev/null +++ b/docs/KEYBOARD_SHORTCUTS.md @@ -0,0 +1,185 @@ +# โŒจ๏ธ KEYBOARD SHORTCUTS - Complete List + +**Date**: December 13, 2025, 01:27 + +--- + +## ๐ŸŽฎ MOVEMENT & BASIC CONTROLS + +| Key | Action | Location | +|-----|--------|----------| +| **W/A/S/D** | Move player | Player.js | +| **SPACE** | Attack / Fishing catch | Player.js, FishingSystem.js | +| **E** | Interact | InteractionSystem.js | +| **ESC** | Pause menu | UIScene.js | + +--- + +## ๐Ÿ”ข INVENTORY & SLOTS + +| Key | Action | Location | +|-----|--------|----------| +| **1-9** | Select inventory slot | GameScene.js | +| **ONE** | Select slot 1 | GameScene.js | +| **TWO** | Select slot 2 | GameScene.js | +| **THREE** | Select slot 3 | GameScene.js | +| **FOUR** | Select slot 4 | GameScene.js | +| **FIVE** | Select slot 5 | GameScene.js | + +--- + +## ๐Ÿ—๏ธ BUILD & CRAFT + +| Key | Action | Location | +|-----|--------|----------| +| **B** | Toggle build mode | GameScene.js | +| **C** | Toggle crafting menu | UIScene.js | + +--- + +## ๐ŸŽฃ FISHING + +| Key | Action | Location | +|-----|--------|----------| +| **R** | Cast fishing rod | FishingSystem.js | +| **SPACE** | Catch fish | FishingSystem.js | +| **LEFT** | Move bobber left | FishingSystem.js | +| **RIGHT** | Move bobber right | FishingSystem.js | + +--- + +## ๐Ÿ‘ฅ BREEDING & ANIMALS + +| Key | Action | Location | +|-----|--------|----------| +| **F** | Toggle breeding UI | BreedingUISystem.js | + +--- + +## ๐ŸŽฌ CAMERA & SCREENSHOTS + +| Key | Action | Location | +|-----|--------|----------| +| **F6** | Start camera mode | CameraSystem.js | +| **F7** | Take screenshot | CameraSystem.js | +| **F8** | Toggle cinematic mode | CameraSystem.js | +| **F10** | Stop camera mode | CameraSystem.js | +| **PAGEUP** | Zoom in | CameraSystem.js | +| **PAGEDOWN** | Zoom out | CameraSystem.js | + +--- + +## ๐Ÿ’พ SAVE & LOAD + +| Key | Action | Location | +|-----|--------|----------| +| **F5** | Quick save | UIScene.js | +| **F8** | Save game | GameScene.js | +| **F9** | Load game | GameScene.js | + +--- + +## ๐Ÿ‰ DEBUG & TESTING + +| Key | Action | Location | +|-----|--------|----------| +| **K** | Spawn boss | GameScene.js | +| **J** | Toggle joystick | UIScene.js | +| **Q** | Toggle quest tracker | UIScene.js | +| **M** | Toggle map | GameScene.js | +| **F3** | Toggle performance monitor | PerformanceMonitor.js | +| **F4** | Reload game | GameScene.js | + +--- + +## โ™ฟ ACCESSIBILITY (Screen Reader) + +| Key | Action | Location | +|-----|--------|----------| +| **Ctrl+H** | Help | ScreenReaderSystem.js | +| **Ctrl+R** | Repeat last | ScreenReaderSystem.js | +| **Ctrl+S** | Settings | ScreenReaderSystem.js | + +--- + +## โš ๏ธ CONFLICTS DETECTED! + +### **F8 - DOUBLE USAGE:** +- โŒ Save game (GameScene.js) +- โŒ Toggle cinematic mode (CameraSystem.js) +- โŒ Save game (UIScene.js) + +### **K - DOUBLE USAGE:** +- โŒ Spawn boss (GameScene.js) +- โŒ Toggle joystick (UIScene.js) + +### **R - DOUBLE USAGE:** +- โŒ Cast fishing rod (FishingSystem.js) +- โŒ Repeat last (ScreenReaderSystem.js - needs Ctrl) + +### **E - DOUBLE USAGE:** +- โŒ Interact (InteractionSystem.js) +- โŒ Unknown (UIScene.js) + +--- + +## โœ… RECOMMENDED FIXES + +### **Save/Load:** +- **F5** = Quick save โœ… +- **F9** = Load game โœ… +- **Remove F8** from save (use F5 only) + +### **Camera:** +- **F6** = Start camera mode โœ… +- **F7** = Screenshot โœ… +- **F8** = Cinematic mode โœ… +- **F10** = Stop camera โœ… + +### **Debug:** +- **K** = Spawn boss โœ… +- **J** = Toggle joystick โœ… +- **Remove K** from UIScene + +### **Stats Panel (NEW):** +- **TAB** = Toggle stats panel (AVAILABLE!) + +--- + +## ๐Ÿ“‹ FINAL ORGANIZED LIST + +### **A-Z Keys:** +- **B** = Build mode +- **C** = Crafting +- **E** = Interact +- **F** = Breeding UI +- **J** = Joystick toggle +- **K** = Spawn boss +- **M** = Map +- **Q** = Quest tracker +- **R** = Fishing cast +- **W/A/S/D** = Movement + +### **Function Keys:** +- **F3** = Performance monitor +- **F4** = Reload game +- **F5** = Quick save +- **F6** = Camera mode +- **F7** = Screenshot +- **F8** = Cinematic mode +- **F9** = Load game +- **F10** = Stop camera + +### **Special Keys:** +- **ESC** = Pause +- **SPACE** = Attack/Catch +- **TAB** = Stats panel (NEW!) +- **1-9** = Inventory slots +- **LEFT/RIGHT** = Fishing bobber +- **PAGEUP/DOWN** = Zoom + +--- + +**All shortcuts organized!** โœ… + +*Created: December 13, 2025, 01:27* diff --git a/docs/STATS_PANEL_PLAN.md b/docs/STATS_PANEL_PLAN.md new file mode 100644 index 0000000..b77a4ba --- /dev/null +++ b/docs/STATS_PANEL_PLAN.md @@ -0,0 +1,42 @@ +# ๐Ÿ“‹ STATS PANEL - Toggle System + +**Plan**: Make stats panel toggleable and follow player + +--- + +## ๐ŸŽฏ CHANGES TO MAKE + +### **1. Toggle on/off** +- Press TAB to show/hide +- Not always visible +- Clean screen when not needed + +### **2. Follow Player** +- Panel appears near player +- Not fixed to screen +- Moves with character + +### **3. Better Design** +- Transparent background +- Smaller size +- Only essential info + +--- + +## ๐Ÿ”ง IMPLEMENTATION + +### **Key Binding:** +- TAB = Toggle stats panel + +### **Position:** +- Above player character +- Offset: (-50, -100) from player + +### **Content:** +- HP, Hunger, Thirst +- Level, XP +- Current tool + +--- + +**Will implement this next!** โœ… diff --git a/docs/UI_IMPROVEMENTS.md b/docs/UI_IMPROVEMENTS.md new file mode 100644 index 0000000..4d3bf25 --- /dev/null +++ b/docs/UI_IMPROVEMENTS.md @@ -0,0 +1,89 @@ +# โœ… UI IMPROVEMENTS - Farm Theme! + +**Date**: December 13, 2025, 01:12 + +--- + +## ๐Ÿ”ง CHANGES MADE + +### **1. Central Popup System** โœ… +- Popups appear in **CENTER** of screen +- Always **in front** of player +- Easy to read +- Beautiful animations +- For quests, story, notifications + +### **2. Zombie & Farm Panels MOVED** โœ… +- **Before**: Left side (blocking view) +- **After**: Right side (below minimap) +- No longer blocking important areas! + +### **3. Farm-Friendly Colors** โœ… +- **Before**: Dark purple/black (too dark) +- **After**: Brown/green farm colors +- Zombie panel: Brown wood (๐Ÿชต) +- Farm panel: Green fields (๐ŸŒพ) + +--- + +## ๐ŸŽจ NEW COLOR SCHEME + +### **Zombie Worker Panel:** +- Background: Brown wood (`0x4a3520`) +- Border: Saddle brown (`0x8B4513`) +- Title: Gold (`#FFD700`) +- Text: Light green (`#90EE90`) + +### **Farm Stats Panel:** +- Background: Dark green (`0x2a4a2a`) +- Border: Light green (`0x90EE90`) +- Title: Light green (`#90EE90`) +- Text: Gold (`#FFD700`) + +--- + +## ๐Ÿ“ NEW POSITIONS + +### **Right Side Layout:** +``` +Top-Right: +โ”œโ”€ Mini Map (80px from top) +โ”œโ”€ Clock (20px from top) +โ”œโ”€ Gold Display (70px from top) +โ”œโ”€ Gen/Age (110px from top) +โ”œโ”€ Zombie Panel (200px from top) โ† NEW +โ””โ”€ Farm Panel (350px from top) โ† NEW +``` + +### **Left Side (Now Clear!):** +``` +Left Side: +โ”œโ”€ HP Bar +โ”œโ”€ Hunger Bar +โ”œโ”€ Thirst Bar +โ”œโ”€ XP Bar +โ””โ”€ Level Display +``` + +**No more overlapping!** โœ… + +--- + +## ๐ŸŽฎ RESULT + +### **Before:** +- Panels on left blocking view โŒ +- Dark purple/black colors โŒ +- Hard to see important info โŒ + +### **After:** +- Panels on right, organized โœ… +- Farm-friendly brown/green โœ… +- Clear view of game โœ… +- Easy to read โœ… + +--- + +**Osveลพi igro s F5 da vidiลก spremembe!** ๐Ÿ”„ + +*Updated: December 13, 2025, 01:12* diff --git a/index.html b/index.html index b69a09c..83a89c0 100644 --- a/index.html +++ b/index.html @@ -155,6 +155,7 @@ + diff --git a/src/game.js b/src/game.js index e31fffc..4d482a0 100644 --- a/src/game.js +++ b/src/game.js @@ -41,8 +41,8 @@ ErrorHandler.init(); // Phaser Game Configuration const config = { type: Phaser.CANVAS, // Canvas renderer za pixel-perfect ostrino - width: 640, // Pixel Art Viewport - height: 360, // Pixel Art Viewport (16:9) + width: 1024, // Larger viewport for better view + height: 768, // 4:3 aspect ratio parent: 'game-container', backgroundColor: '#1a1a2e', pixelArt: true, diff --git a/src/scenes/UIScene.js b/src/scenes/UIScene.js index cffc204..c52364f 100644 --- a/src/scenes/UIScene.js +++ b/src/scenes/UIScene.js @@ -2185,54 +2185,54 @@ class UIScene extends Phaser.Scene { createZombieStatsPanel() { const panelWidth = 180; const panelHeight = 130; - const x = 20; - const y = 120; // Below player stats + const x = this.scale.width - panelWidth - 20; // RIGHT SIDE + const y = 200; // Below minimap // Container this.zombieStatsContainer = this.add.container(x, y); this.zombieStatsContainer.setDepth(1000); - // Background + // Background - FARM THEME const bg = this.add.graphics(); - bg.fillStyle(0x1a1a2e, 0.9); + bg.fillStyle(0x4a3520, 0.9); // Brown wood bg.fillRect(0, 0, panelWidth, panelHeight); - bg.lineStyle(2, 0x8a2be2, 0.8); // Purple border + bg.lineStyle(3, 0x8B4513, 0.8); // Saddle brown bg.strokeRect(0, 0, panelWidth, panelHeight); this.zombieStatsContainer.add(bg); // Title - const title = this.add.text(panelWidth / 2, 12, '๐ŸงŸ ZOMBIE', { - fontSize: '12px', - fontFamily: 'Courier New', - fill: '#8a2be2', + const title = this.add.text(panelWidth / 2, 12, '๐ŸงŸ WORKER', { + fontSize: '14px', + fontFamily: 'Arial', + fill: '#FFD700', fontStyle: 'bold' }).setOrigin(0.5); this.zombieStatsContainer.add(title); // Stats Text - this.zombieNameText = this.add.text(8, 30, 'Name: Worker #1', { - fontSize: '10px', + this.zombieNameText = this.add.text(8, 35, 'Name: Worker #1', { + fontSize: '11px', fill: '#ffffff' }); this.zombieStatsContainer.add(this.zombieNameText); - this.zombieTaskText = this.add.text(8, 48, 'Task: IDLE', { - fontSize: '10px', - fill: '#ffff00' + this.zombieTaskText = this.add.text(8, 53, 'Task: IDLE', { + fontSize: '11px', + fill: '#90EE90' }); this.zombieStatsContainer.add(this.zombieTaskText); - this.zombieLevelText = this.add.text(8, 66, 'Level: 1 (0/100 XP)', { - fontSize: '10px', - fill: '#00ff00' + this.zombieLevelText = this.add.text(8, 71, 'Level: 1 (0/100 XP)', { + fontSize: '11px', + fill: '#FFD700' }); this.zombieStatsContainer.add(this.zombieLevelText); // Energy Bar - const energyLabel = this.add.text(8, 84, 'ENERGY:', { fontSize: '9px', fill: '#aaaaaa' }); + const energyLabel = this.add.text(8, 89, 'ENERGY:', { fontSize: '10px', fill: '#cccccc' }); this.zombieStatsContainer.add(energyLabel); - this.zombieEnergyBar = this.drawMiniBar(8, 98, panelWidth - 16, 12, 0x00aaff, 100); + this.zombieEnergyBar = this.drawMiniBar(8, 103, panelWidth - 16, 12, 0x90EE90, 100); this.zombieStatsContainer.add(this.zombieEnergyBar.bg); this.zombieStatsContainer.add(this.zombieEnergyBar.fill); @@ -2243,51 +2243,51 @@ class UIScene extends Phaser.Scene { createFarmStatsPanel() { const panelWidth = 180; const panelHeight = 110; - const x = 20; - const y = 270; // Below zombie stats + const x = this.scale.width - panelWidth - 20; // RIGHT SIDE + const y = 350; // Below zombie stats // Container this.farmStatsContainer = this.add.container(x, y); this.farmStatsContainer.setDepth(1000); - // Background + // Background - FARM THEME const bg = this.add.graphics(); - bg.fillStyle(0x1a2e1a, 0.9); + bg.fillStyle(0x2a4a2a, 0.9); // Dark green bg.fillRect(0, 0, panelWidth, panelHeight); - bg.lineStyle(2, 0x00ff00, 0.8); // Green border + bg.lineStyle(3, 0x90EE90, 0.8); // Light green border bg.strokeRect(0, 0, panelWidth, panelHeight); this.farmStatsContainer.add(bg); // Title const title = this.add.text(panelWidth / 2, 12, '๐ŸŒพ FARM', { - fontSize: '12px', - fontFamily: 'Courier New', - fill: '#00ff00', + fontSize: '14px', + fontFamily: 'Arial', + fill: '#90EE90', fontStyle: 'bold' }).setOrigin(0.5); this.farmStatsContainer.add(title); // Stats - this.farmCropsPlantedText = this.add.text(8, 32, 'Planted: 0', { - fontSize: '10px', + this.farmCropsPlantedText = this.add.text(8, 35, 'Planted: 0', { + fontSize: '11px', fill: '#ffffff' }); this.farmStatsContainer.add(this.farmCropsPlantedText); - this.farmCropsHarvestedText = this.add.text(8, 50, 'Harvested: 0', { - fontSize: '10px', - fill: '#ffff00' + this.farmCropsHarvestedText = this.add.text(8, 53, 'Harvested: 0', { + fontSize: '11px', + fill: '#FFD700' }); this.farmStatsContainer.add(this.farmCropsHarvestedText); - this.farmGoldEarnedText = this.add.text(8, 68, 'Gold: 0g', { - fontSize: '10px', - fill: '#ffd700' + this.farmGoldEarnedText = this.add.text(8, 71, 'Gold: 0g', { + fontSize: '11px', + fill: '#FFD700' }); this.farmStatsContainer.add(this.farmGoldEarnedText); - this.farmDaysText = this.add.text(8, 86, 'Days: 0', { - fontSize: '10px', + this.farmDaysText = this.add.text(8, 89, 'Days: 0', { + fontSize: '11px', fill: '#aaaaaa' }); this.farmStatsContainer.add(this.farmDaysText); @@ -2490,47 +2490,50 @@ class UIScene extends Phaser.Scene { // Equipment Preview createEquipmentPreview() { const previewX = 20; - const previewY = 150; + const previewY = 400; // MOVED LOWER (was 150) - // Background + // Background - SMALLER this.equipmentBg = this.add.graphics(); - this.equipmentBg.fillStyle(0x000000, 0.6); - this.equipmentBg.fillRoundedRect(previewX, previewY, 80, 80, 8); + this.equipmentBg.fillStyle(0x4a3520, 0.8); // Brown wood color + this.equipmentBg.fillRoundedRect(previewX, previewY, 60, 60, 8); // 60x60 (was 80x80) + this.equipmentBg.lineStyle(2, 0x8B4513, 1); + this.equipmentBg.strokeRoundedRect(previewX, previewY, 60, 60, 8); this.equipmentBg.setScrollFactor(0); this.equipmentBg.setDepth(1000); - // Label + // Label - SMALLER this.equipmentLabel = this.add.text( - previewX + 40, + previewX + 30, previewY - 5, - 'EQUIPPED', + 'TOOL', { - font: 'bold 10px Arial', - fill: '#ffff00' + font: 'bold 9px Arial', + fill: '#FFD700' } ); this.equipmentLabel.setOrigin(0.5, 1); this.equipmentLabel.setScrollFactor(0); this.equipmentLabel.setDepth(1001); - // Icon sprite placeholder - this.equipmentIcon = this.add.rectangle(previewX + 40, previewY + 40, 32, 32, 0x888888); + // Icon sprite placeholder - SMALLER + this.equipmentIcon = this.add.rectangle(previewX + 30, previewY + 30, 24, 24, 0x888888); this.equipmentIcon.setScrollFactor(0); this.equipmentIcon.setDepth(1001); - // Tool name + // Tool name - HIDDEN (too much text) this.equipmentName = this.add.text( - previewX + 40, - previewY + 75, - 'None', + previewX + 30, + previewY + 50, + '', { - font: 'bold 12px Arial', + font: 'bold 8px Arial', fill: '#ffffff' } ); this.equipmentName.setOrigin(0.5, 0); this.equipmentName.setScrollFactor(0); this.equipmentName.setDepth(1001); + this.equipmentName.setVisible(false); // HIDDEN console.log('๐ŸŽฎ Equipment preview created!'); } diff --git a/src/systems/AccessibilitySystem.js b/src/systems/AccessibilitySystem.js index 10cbd80..feb0484 100644 --- a/src/systems/AccessibilitySystem.js +++ b/src/systems/AccessibilitySystem.js @@ -283,42 +283,53 @@ class AccessibilitySystem { // EPILEPSY WARNING showEpilepsyWarning(onContinue) { - const warning = this.scene.add.container( - this.scene.cameras.main.centerX, - this.scene.cameras.main.centerY + // Get UIScene for proper positioning + const uiScene = this.scene.scene.get('UIScene') || this.scene; + + const warning = uiScene.add.container( + uiScene.scale.width / 2, + uiScene.scale.height / 2 ); - warning.setDepth(10000); + warning.setDepth(99999); // ALWAYS ON TOP warning.setScrollFactor(0); - const bg = this.scene.add.rectangle(0, 0, 600, 400, 0x000000, 0.95); + // Dark background overlay + const bg = uiScene.add.rectangle(0, 0, 700, 500, 0x000000, 0.98); + bg.setStrokeStyle(4, 0xff0000); - const title = this.scene.add.text(0, -150, 'โš ๏ธ EPILEPSY WARNING', { - fontSize: '32px', + const title = uiScene.add.text(0, -180, 'โš ๏ธ EPILEPSY WARNING', { + fontSize: '36px', color: '#ff0000', - fontStyle: 'bold' + fontStyle: 'bold', + stroke: '#000000', + strokeThickness: 4 }).setOrigin(0.5); - const text = this.scene.add.text(0, -50, + const text = uiScene.add.text(0, -60, 'This game contains flashing lights\n' + 'that may trigger seizures in people with\n' + 'photosensitive epilepsy.\n\n' + 'Player discretion is advised.', { - fontSize: '18px', + fontSize: '20px', color: '#ffffff', align: 'center', - wordWrap: { width: 500 } + wordWrap: { width: 600 }, + lineSpacing: 8 } ).setOrigin(0.5); - const enableBtn = this.scene.add.text(0, 100, '[ ENABLE PROTECTION ]', { - fontSize: '20px', + const enableBtn = uiScene.add.text(0, 120, '[ ENABLE PROTECTION ]', { + fontSize: '24px', color: '#00ff00', backgroundColor: '#003300', - padding: { x: 20, y: 10 } + padding: { x: 30, y: 15 }, + fontStyle: 'bold' }).setOrigin(0.5); enableBtn.setInteractive({ useHandCursor: true }); + enableBtn.on('pointerover', () => enableBtn.setScale(1.1)); + enableBtn.on('pointerout', () => enableBtn.setScale(1.0)); enableBtn.on('pointerdown', () => { this.settings.photosensitivity = true; this.applySettings(); @@ -327,12 +338,16 @@ class AccessibilitySystem { if (onContinue) onContinue(); }); - const continueBtn = this.scene.add.text(0, 150, '[ CONTINUE WITHOUT ]', { - fontSize: '16px', - color: '#888888' + const continueBtn = uiScene.add.text(0, 180, '[ CONTINUE WITHOUT ]', { + fontSize: '18px', + color: '#888888', + backgroundColor: '#222222', + padding: { x: 20, y: 10 } }).setOrigin(0.5); continueBtn.setInteractive({ useHandCursor: true }); + continueBtn.on('pointerover', () => continueBtn.setScale(1.1)); + continueBtn.on('pointerout', () => continueBtn.setScale(1.0)); continueBtn.on('pointerdown', () => { warning.destroy(); if (onContinue) onContinue(); diff --git a/src/systems/CentralPopupSystem.js b/src/systems/CentralPopupSystem.js new file mode 100644 index 0000000..3af008a --- /dev/null +++ b/src/systems/CentralPopupSystem.js @@ -0,0 +1,359 @@ +/** + * CENTRAL POPUP SYSTEM + * Displays important messages, quests, and dialogs in center of screen + * Always appears in front of player for easy reading + */ +class CentralPopupSystem { + constructor(scene) { + this.scene = scene; + this.enabled = true; + + // Current popup + this.currentPopup = null; + this.popupQueue = []; + this.isShowing = false; + + // Settings + this.settings = { + enabled: true, + autoClose: true, + autoCloseDelay: 5000, // 5 seconds + pauseGameOnPopup: true, + soundOnPopup: true + }; + + this.loadSettings(); + console.log('โœ… Central Popup System initialized'); + } + + /** + * Show popup in center of screen + */ + showPopup(config) { + const popup = { + title: config.title || 'Notification', + message: config.message || '', + type: config.type || 'info', // info, quest, warning, success, story + icon: config.icon || '๐Ÿ“‹', + buttons: config.buttons || [{ text: 'OK', action: 'close' }], + image: config.image || null, + autoClose: config.autoClose !== undefined ? config.autoClose : this.settings.autoClose, + onClose: config.onClose || null, + priority: config.priority || 'normal' // low, normal, high, critical + }; + + // Add to queue + this.popupQueue.push(popup); + + // Show if not already showing + if (!this.isShowing) { + this.displayNextPopup(); + } + } + + /** + * Display next popup from queue + */ + displayNextPopup() { + if (this.popupQueue.length === 0) { + this.isShowing = false; + return; + } + + this.isShowing = true; + const popup = this.popupQueue.shift(); + + // Get UIScene + const uiScene = this.scene.scene.get('UIScene'); + if (!uiScene) return; + + // Pause game if needed + if (this.settings.pauseGameOnPopup) { + this.scene.physics.pause(); + } + + // Create popup container + const centerX = uiScene.scale.width / 2; + const centerY = uiScene.scale.height / 2; + + this.currentPopup = uiScene.add.container(centerX, centerY); + this.currentPopup.setDepth(10000); // Always on top + this.currentPopup.setScrollFactor(0); + + // Popup size based on type + const width = popup.type === 'story' ? 600 : 500; + const height = popup.type === 'story' ? 400 : 300; + + // Background overlay (darken screen) + const overlay = uiScene.add.rectangle(0, 0, uiScene.scale.width * 2, uiScene.scale.height * 2, 0x000000, 0.7); + overlay.setOrigin(0.5); + this.currentPopup.add(overlay); + + // Main popup background + const bg = uiScene.add.graphics(); + + // Color based on type + let bgColor = 0x2a2a3e; + let borderColor = 0x4e4e6e; + + if (popup.type === 'quest') { + bgColor = 0x3a2a1e; + borderColor = 0xFFD700; + } else if (popup.type === 'warning') { + bgColor = 0x3e2a2a; + borderColor = 0xff4444; + } else if (popup.type === 'success') { + bgColor = 0x2a3e2a; + borderColor = 0x44ff44; + } else if (popup.type === 'story') { + bgColor = 0x1a1a2e; + borderColor = 0x8888ff; + } + + // Draw background with rounded corners + bg.fillStyle(bgColor, 0.95); + bg.fillRoundedRect(-width / 2, -height / 2, width, height, 16); + bg.lineStyle(4, borderColor, 1); + bg.strokeRoundedRect(-width / 2, -height / 2, width, height, 16); + this.currentPopup.add(bg); + + // Icon + const iconText = uiScene.add.text(-width / 2 + 30, -height / 2 + 30, popup.icon, { + fontSize: '48px' + }); + this.currentPopup.add(iconText); + + // Title + const title = uiScene.add.text(0, -height / 2 + 50, popup.title, { + fontSize: '28px', + fontFamily: 'Arial', + fill: '#ffffff', + fontStyle: 'bold', + align: 'center' + }).setOrigin(0.5); + this.currentPopup.add(title); + + // Separator line + const separator = uiScene.add.graphics(); + separator.lineStyle(2, borderColor, 0.5); + separator.lineBetween(-width / 2 + 20, -height / 2 + 90, width / 2 - 20, -height / 2 + 90); + this.currentPopup.add(separator); + + // Message + const message = uiScene.add.text(0, -height / 2 + 150, popup.message, { + fontSize: '18px', + fontFamily: 'Arial', + fill: '#dddddd', + align: 'center', + wordWrap: { width: width - 80 } + }).setOrigin(0.5, 0); + this.currentPopup.add(message); + + // Image (if provided) + if (popup.image) { + const img = uiScene.add.image(0, -height / 2 + 120, popup.image); + img.setScale(0.5); + this.currentPopup.add(img); + } + + // Buttons + const buttonY = height / 2 - 50; + const buttonSpacing = 150; + const buttonStartX = -(popup.buttons.length - 1) * buttonSpacing / 2; + + popup.buttons.forEach((btn, index) => { + const btnX = buttonStartX + index * buttonSpacing; + + // Button background + const btnBg = uiScene.add.graphics(); + btnBg.fillStyle(0x4a4a6e, 1); + btnBg.fillRoundedRect(btnX - 60, buttonY - 20, 120, 40, 8); + btnBg.lineStyle(2, borderColor, 1); + btnBg.strokeRoundedRect(btnX - 60, buttonY - 20, 120, 40, 8); + btnBg.setInteractive( + new Phaser.Geom.Rectangle(btnX - 60, buttonY - 20, 120, 40), + Phaser.Geom.Rectangle.Contains + ); + + // Hover effect + btnBg.on('pointerover', () => { + btnBg.clear(); + btnBg.fillStyle(0x6a6a8e, 1); + btnBg.fillRoundedRect(btnX - 60, buttonY - 20, 120, 40, 8); + btnBg.lineStyle(2, borderColor, 1); + btnBg.strokeRoundedRect(btnX - 60, buttonY - 20, 120, 40, 8); + }); + + btnBg.on('pointerout', () => { + btnBg.clear(); + btnBg.fillStyle(0x4a4a6e, 1); + btnBg.fillRoundedRect(btnX - 60, buttonY - 20, 120, 40, 8); + btnBg.lineStyle(2, borderColor, 1); + btnBg.strokeRoundedRect(btnX - 60, buttonY - 20, 120, 40, 8); + }); + + // Click handler + btnBg.on('pointerdown', () => { + if (btn.action === 'close') { + this.closePopup(popup); + } else if (btn.callback) { + btn.callback(); + this.closePopup(popup); + } + }); + + this.currentPopup.add(btnBg); + + // Button text + const btnText = uiScene.add.text(btnX, buttonY, btn.text, { + fontSize: '18px', + fontFamily: 'Arial', + fill: '#ffffff', + fontStyle: 'bold' + }).setOrigin(0.5); + this.currentPopup.add(btnText); + }); + + // Auto-close timer + if (popup.autoClose && this.settings.autoClose) { + uiScene.time.delayedCall(this.settings.autoCloseDelay, () => { + this.closePopup(popup); + }); + } + + // Play sound + if (this.settings.soundOnPopup && this.scene.soundManager) { + this.scene.soundManager.beepPickup(); + } + + // Animate in + this.currentPopup.setScale(0.8); + this.currentPopup.setAlpha(0); + uiScene.tweens.add({ + targets: this.currentPopup, + scale: 1, + alpha: 1, + duration: 300, + ease: 'Back.easeOut' + }); + + console.log(`๐Ÿ“‹ Popup shown: ${popup.title}`); + } + + /** + * Close current popup + */ + closePopup(popup) { + if (!this.currentPopup) return; + + const uiScene = this.scene.scene.get('UIScene'); + if (!uiScene) return; + + // Animate out + uiScene.tweens.add({ + targets: this.currentPopup, + scale: 0.8, + alpha: 0, + duration: 200, + ease: 'Power2', + onComplete: () => { + this.currentPopup.destroy(); + this.currentPopup = null; + + // Resume game + if (this.settings.pauseGameOnPopup) { + this.scene.physics.resume(); + } + + // Call onClose callback + if (popup.onClose) { + popup.onClose(); + } + + // Show next popup + this.displayNextPopup(); + } + }); + } + + /** + * Show quest popup + */ + showQuest(title, description, objectives) { + this.showPopup({ + title: title, + message: description + '\n\nObjectives:\n' + objectives.map((obj, i) => `${i + 1}. ${obj}`).join('\n'), + type: 'quest', + icon: '๐Ÿ“œ', + buttons: [ + { text: 'Accept', action: 'close' }, + { text: 'Decline', action: 'close' } + ], + autoClose: false + }); + } + + /** + * Show story popup + */ + showStory(title, text, image = null) { + this.showPopup({ + title: title, + message: text, + type: 'story', + icon: '๐Ÿ“–', + image: image, + buttons: [{ text: 'Continue', action: 'close' }], + autoClose: false + }); + } + + /** + * Show notification + */ + showNotification(message, type = 'info') { + const icons = { + 'info': 'โ„น๏ธ', + 'success': 'โœ…', + 'warning': 'โš ๏ธ', + 'error': 'โŒ' + }; + + this.showPopup({ + title: type.charAt(0).toUpperCase() + type.slice(1), + message: message, + type: type, + icon: icons[type] || 'โ„น๏ธ', + buttons: [{ text: 'OK', action: 'close' }], + autoClose: true + }); + } + + /** + * Save settings + */ + saveSettings() { + localStorage.setItem('novafarma_popup_settings', JSON.stringify(this.settings)); + } + + /** + * Load settings + */ + loadSettings() { + const saved = localStorage.getItem('novafarma_popup_settings'); + if (saved) { + this.settings = { ...this.settings, ...JSON.parse(saved) }; + } + } + + /** + * Destroy system + */ + destroy() { + if (this.currentPopup) { + this.currentPopup.destroy(); + } + this.popupQueue = []; + console.log('๐Ÿ“‹ Central Popup System destroyed'); + } +}