shrani
This commit is contained in:
202
archive/tests/ADVANCED_BUILD_MODE_CODE.js
Normal file
202
archive/tests/ADVANCED_BUILD_MODE_CODE.js
Normal file
@@ -0,0 +1,202 @@
|
||||
// ADVANCED BUILD MODE - IMPLEMENTATION
|
||||
// Dodaj te metode v BuildSystem.js
|
||||
|
||||
// 1. ROTATION (R key)
|
||||
rotatePreview() {
|
||||
this.rotation = (this.rotation + 90) % 360;
|
||||
|
||||
if (this.previewSprite) {
|
||||
this.previewSprite.setAngle(this.rotation);
|
||||
}
|
||||
|
||||
// Sound effect
|
||||
if (this.scene.soundManager) {
|
||||
this.scene.soundManager.beepUIClick();
|
||||
}
|
||||
|
||||
console.log(`🔄 Building rotated: ${this.rotation}°`);
|
||||
}
|
||||
|
||||
// 2. CONFIRM PLACEMENT (E key)
|
||||
confirmPlacement() {
|
||||
if (!this.buildMode || !this.previewSprite) return;
|
||||
|
||||
const gridPos = this.scene.iso.toGrid(
|
||||
this.previewSprite.x,
|
||||
this.previewSprite.y
|
||||
);
|
||||
|
||||
// Try to place building
|
||||
const success = this.placeBuilding(gridPos.x, gridPos.y);
|
||||
|
||||
if (success) {
|
||||
console.log('✅ Building placed!');
|
||||
|
||||
// Keep build mode active for multiple placements
|
||||
this.createPreview();
|
||||
}
|
||||
}
|
||||
|
||||
// 3. CANCEL PLACEMENT (ESC key)
|
||||
cancelPlacement() {
|
||||
if (!this.buildMode) return;
|
||||
|
||||
this.toggleBuildMode(); // Exit build mode
|
||||
|
||||
console.log('❌ Build mode cancelled');
|
||||
}
|
||||
|
||||
// 4. BUILDING INVENTORY UI
|
||||
showBuildUI() {
|
||||
const uiScene = this.scene.scene.get('UIScene');
|
||||
if (!uiScene) return;
|
||||
|
||||
const panelX = 20;
|
||||
const panelY = 250;
|
||||
const panelWidth = 200;
|
||||
|
||||
// Background
|
||||
this.buildPanel = uiScene.add.graphics();
|
||||
this.buildPanel.fillStyle(0x000000, 0.8);
|
||||
this.buildPanel.fillRoundedRect(panelX, panelY, panelWidth, 400, 8);
|
||||
this.buildPanel.setScrollFactor(0);
|
||||
this.buildPanel.setDepth(1000);
|
||||
|
||||
// Title
|
||||
this.buildTitle = uiScene.add.text(
|
||||
panelX + panelWidth / 2,
|
||||
panelY + 10,
|
||||
'🏗️ BUILDINGS',
|
||||
{
|
||||
fontSize: '16px',
|
||||
fontStyle: 'bold',
|
||||
color: '#ffff00'
|
||||
}
|
||||
);
|
||||
this.buildTitle.setOrigin(0.5, 0);
|
||||
this.buildTitle.setScrollFactor(0);
|
||||
this.buildTitle.setDepth(1001);
|
||||
|
||||
// Building list
|
||||
this.buildingButtons = [];
|
||||
let yOffset = 40;
|
||||
|
||||
Object.entries(this.buildings).forEach(([id, building]) => {
|
||||
// Button background
|
||||
const btn = uiScene.add.rectangle(
|
||||
panelX + panelWidth / 2,
|
||||
panelY + yOffset,
|
||||
panelWidth - 20,
|
||||
40,
|
||||
this.selectedBuilding === id ? 0x00ff00 : 0x333333
|
||||
);
|
||||
btn.setInteractive({ useHandCursor: true });
|
||||
btn.setScrollFactor(0);
|
||||
btn.setDepth(1001);
|
||||
|
||||
// Building name
|
||||
const name = uiScene.add.text(
|
||||
panelX + 15,
|
||||
panelY + yOffset - 15,
|
||||
building.name,
|
||||
{
|
||||
fontSize: '14px',
|
||||
color: '#ffffff'
|
||||
}
|
||||
);
|
||||
name.setScrollFactor(0);
|
||||
name.setDepth(1002);
|
||||
|
||||
// Cost
|
||||
const costText = Object.entries(building.cost)
|
||||
.map(([res, amt]) => `${amt} ${res}`)
|
||||
.join(', ');
|
||||
|
||||
const cost = uiScene.add.text(
|
||||
panelX + 15,
|
||||
panelY + yOffset + 5,
|
||||
costText,
|
||||
{
|
||||
fontSize: '10px',
|
||||
color: '#aaaaaa'
|
||||
}
|
||||
);
|
||||
cost.setScrollFactor(0);
|
||||
cost.setDepth(1002);
|
||||
|
||||
// Click handler
|
||||
btn.on('pointerdown', () => {
|
||||
this.selectBuilding(id);
|
||||
this.hideBuildUI();
|
||||
this.showBuildUI(); // Refresh
|
||||
});
|
||||
|
||||
this.buildingButtons.push({ btn, name, cost });
|
||||
yOffset += 50;
|
||||
});
|
||||
|
||||
// Instructions
|
||||
this.buildInstructions = uiScene.add.text(
|
||||
panelX + panelWidth / 2,
|
||||
panelY + 380,
|
||||
'R: Rotate\nE: Place\nESC: Cancel',
|
||||
{
|
||||
fontSize: '12px',
|
||||
color: '#ffff00',
|
||||
align: 'center'
|
||||
}
|
||||
);
|
||||
this.buildInstructions.setOrigin(0.5, 0);
|
||||
this.buildInstructions.setScrollFactor(0);
|
||||
this.buildInstructions.setDepth(1001);
|
||||
|
||||
console.log('🏗️ Build UI shown');
|
||||
}
|
||||
|
||||
hideBuildUI() {
|
||||
if (this.buildPanel) {
|
||||
this.buildPanel.destroy();
|
||||
this.buildPanel = null;
|
||||
}
|
||||
|
||||
if (this.buildTitle) {
|
||||
this.buildTitle.destroy();
|
||||
this.buildTitle = null;
|
||||
}
|
||||
|
||||
if (this.buildInstructions) {
|
||||
this.buildInstructions.destroy();
|
||||
this.buildInstructions = null;
|
||||
}
|
||||
|
||||
if (this.buildingButtons) {
|
||||
this.buildingButtons.forEach(({ btn, name, cost }) => {
|
||||
btn.destroy();
|
||||
name.destroy();
|
||||
cost.destroy();
|
||||
});
|
||||
this.buildingButtons = [];
|
||||
}
|
||||
}
|
||||
|
||||
// POSODOBI toggleBuildMode() metodo:
|
||||
toggleBuildMode() {
|
||||
this.buildMode = !this.buildMode;
|
||||
console.log(`Build Mode: ${this.buildMode ? 'ON' : 'OFF'}`);
|
||||
|
||||
// Show/hide preview
|
||||
if (this.buildMode) {
|
||||
this.createPreview();
|
||||
this.showBuildUI(); // Dodaj UI
|
||||
} else {
|
||||
this.destroyPreview();
|
||||
this.hideBuildUI(); // Skrij UI
|
||||
}
|
||||
|
||||
return this.buildMode;
|
||||
}
|
||||
|
||||
// DODAJ V constructor():
|
||||
// this.rotation = 0;
|
||||
// this.buildPanel = null;
|
||||
// this.buildingButtons = [];
|
||||
26
archive/tests/GAMESCENE_KEYBOARD_BINDINGS.js
Normal file
26
archive/tests/GAMESCENE_KEYBOARD_BINDINGS.js
Normal file
@@ -0,0 +1,26 @@
|
||||
// GAMESCENE.JS - KEYBOARD BINDINGS
|
||||
// Dodaj te key listenere v setupCamera() metodo
|
||||
|
||||
// R key - Rotate building
|
||||
this.input.keyboard.on('keydown-R', () => {
|
||||
if (this.buildSystem && this.buildSystem.buildMode) {
|
||||
this.buildSystem.rotatePreview();
|
||||
}
|
||||
});
|
||||
|
||||
// E key - Confirm placement
|
||||
this.input.keyboard.on('keydown-E', () => {
|
||||
if (this.buildSystem && this.buildSystem.buildMode) {
|
||||
this.buildSystem.confirmPlacement();
|
||||
}
|
||||
});
|
||||
|
||||
// ESC key - Cancel (posodobi obstoječi ESC listener)
|
||||
this.input.keyboard.on('keydown-ESC', () => {
|
||||
if (this.buildSystem && this.buildSystem.buildMode) {
|
||||
this.buildSystem.cancelPlacement();
|
||||
} else {
|
||||
// Existing ESC functionality
|
||||
this.togglePauseMenu();
|
||||
}
|
||||
});
|
||||
34
archive/tests/QUICK_VIDEO_TEST.js
Normal file
34
archive/tests/QUICK_VIDEO_TEST.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// QUICK VIDEO TEST - DODAJ V GAMESCENE.JS
|
||||
|
||||
// 1. DODAJ preload() METODO (pred create()):
|
||||
preload() {
|
||||
// Load video
|
||||
this.load.video('hoja', 'assets/videos/hoja.mp4');
|
||||
console.log('🎬 Loading video: hoja.mp4');
|
||||
}
|
||||
|
||||
// 2. DODAJ V create() NA KONEC (pred Antigravity_Start):
|
||||
// 🎬 VIDEO TEST - Hoja character
|
||||
console.log('🎬 Creating video test character...');
|
||||
this.videoTest = this.add.video(
|
||||
this.cameras.main.centerX,
|
||||
this.cameras.main.centerY,
|
||||
'hoja'
|
||||
);
|
||||
this.videoTest.setOrigin(0.5);
|
||||
this.videoTest.setScale(0.3); // Adjust size
|
||||
this.videoTest.setDepth(1000); // Above everything
|
||||
this.videoTest.play(true); // Loop
|
||||
|
||||
// Arrow key movement
|
||||
this.input.keyboard.on('keydown', (event) => {
|
||||
const speed = 10;
|
||||
if (event.key === 'ArrowLeft') this.videoTest.x -= speed;
|
||||
if (event.key === 'ArrowRight') this.videoTest.x += speed;
|
||||
if (event.key === 'ArrowUp') this.videoTest.y -= speed;
|
||||
if (event.key === 'ArrowDown') this.videoTest.y += speed;
|
||||
});
|
||||
|
||||
console.log('🎬 Video test ready! Use arrow keys ⬅️⬆️⬇️➡️ to move.');
|
||||
|
||||
// 3. DONE! Zaženi igro in premikaj z arrow keys!
|
||||
109
archive/tests/STAMINA_SYSTEM_INTEGRATION.js
Normal file
109
archive/tests/STAMINA_SYSTEM_INTEGRATION.js
Normal file
@@ -0,0 +1,109 @@
|
||||
// STAMINA SYSTEM - INTEGRATION GUIDE
|
||||
|
||||
// 1. DODAJ V index.html (po AccessibilitySystem.js):
|
||||
<script src="src/systems/StaminaSystem.js"></script> <!--Stamina System-- >
|
||||
|
||||
// 2. DODAJ V GameScene.js create() metodo:
|
||||
// Initialize Stamina System
|
||||
console.log('⚡ Initializing Stamina System...');
|
||||
this.staminaSystem = new StaminaSystem(this);
|
||||
this.staminaSystem.createUI();
|
||||
|
||||
// 3. DODAJ V GameScene.js update() metodo:
|
||||
if (this.staminaSystem) this.staminaSystem.update(delta);
|
||||
|
||||
// 4. POSODOBI FarmingSystem.js - tillSoil():
|
||||
tillSoil(gridX, gridY) {
|
||||
// Check stamina
|
||||
if (!this.scene.staminaSystem.useStamina('till')) {
|
||||
console.log('⚡ Not enough stamina to till!');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Existing till logic...
|
||||
}
|
||||
|
||||
// 5. POSODOBI FarmingSystem.js - plantSeed():
|
||||
plantSeed(gridX, gridY, seedType) {
|
||||
// Check stamina
|
||||
if (!this.scene.staminaSystem.useStamina('plant')) {
|
||||
console.log('⚡ Not enough stamina to plant!');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Existing plant logic...
|
||||
}
|
||||
|
||||
// 6. POSODOBI FarmingSystem.js - harvestCrop():
|
||||
harvestCrop(gridX, gridY) {
|
||||
// Check stamina
|
||||
if (!this.scene.staminaSystem.useStamina('harvest')) {
|
||||
console.log('⚡ Not enough stamina to harvest!');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Existing harvest logic...
|
||||
}
|
||||
|
||||
// 7. POSODOBI BuildSystem.js - placeBuilding():
|
||||
placeBuilding(gridX, gridY) {
|
||||
// Check stamina
|
||||
if (!this.scene.staminaSystem.useStamina('build')) {
|
||||
console.log('⚡ Not enough stamina to build!');
|
||||
return false;
|
||||
}
|
||||
|
||||
// Existing build logic...
|
||||
}
|
||||
|
||||
// 8. FOOD RESTORES STAMINA
|
||||
// V InventorySystem.js - consumeItem():
|
||||
if (item.type === 'carrot' || item.type === 'wheat') {
|
||||
// Restore stamina
|
||||
if (this.scene.staminaSystem) {
|
||||
this.scene.staminaSystem.restoreStamina(20);
|
||||
}
|
||||
}
|
||||
|
||||
// 9. SAVE/LOAD INTEGRATION
|
||||
// V SaveSystem.js - getSaveData():
|
||||
stamina: this.scene.staminaSystem.getSaveData(),
|
||||
|
||||
// V SaveSystem.js - loadSaveData():
|
||||
if (data.stamina) {
|
||||
this.scene.staminaSystem.loadSaveData(data.stamina);
|
||||
}
|
||||
|
||||
// 10. TESTING
|
||||
// Console commands:
|
||||
window.testStamina = () => {
|
||||
console.log('Current stamina:', gameScene.staminaSystem.currentStamina);
|
||||
gameScene.staminaSystem.useStamina('till');
|
||||
};
|
||||
|
||||
window.restoreStamina = (amount = 50) => {
|
||||
gameScene.staminaSystem.restoreStamina(amount);
|
||||
};
|
||||
|
||||
// USAGE:
|
||||
// - Farming actions cost stamina
|
||||
// - Stamina auto-regenerates after 2 seconds
|
||||
// - Food restores stamina
|
||||
// - Stamina bar shows below health (yellow)
|
||||
// - Icon: ⚡
|
||||
|
||||
// STAMINA COSTS:
|
||||
// - Till: 5
|
||||
// - Plant: 3
|
||||
// - Harvest: 4
|
||||
// - Build: 10
|
||||
// - Attack: 8
|
||||
// - Sprint: 2/sec
|
||||
|
||||
// FEATURES:
|
||||
// ✅ Stamina bar (yellow, below health)
|
||||
// ✅ Auto-regenerate (5/sec after 2s delay)
|
||||
// ✅ Farming costs stamina
|
||||
// ✅ Food restores stamina
|
||||
// ✅ Save/Load support
|
||||
// ✅ Visual feedback
|
||||
57
archive/tests/TEST_FENCE_PLACEMENT.js
Normal file
57
archive/tests/TEST_FENCE_PLACEMENT.js
Normal file
@@ -0,0 +1,57 @@
|
||||
// ========================================================
|
||||
// TESTNI PRIMER - Postavitev Ograj
|
||||
// ========================================================
|
||||
//
|
||||
// KAKO UPORABITI:
|
||||
// 1. Kopiraj celotno vsebino te datoteke
|
||||
// 2. Odpri src/scenes/GameScene.js
|
||||
// 3. Najdi create() metodo
|
||||
// 4. Prilepi kodo TAKOJ PO: this.buildSystem = new BuildSystem(this);
|
||||
// 5. Shrani in osveži igro (F5 ali ponovno zaženi npm start)
|
||||
// ========================================================
|
||||
|
||||
// TESTNI PRIMER 1: Ena sama ograja
|
||||
this.buildSystem.placeSingleFence(50, 50, 'fence_post', false);
|
||||
console.log('✅ Test 1: Ena ograja postavljena na (50, 50)');
|
||||
|
||||
// TESTNI PRIMER 2: Vodoravna linija ograj (10 ograj)
|
||||
for (let i = 0; i < 10; i++) {
|
||||
this.buildSystem.placeSingleFence(45 + i, 52, 'fence_horizontal', false);
|
||||
}
|
||||
console.log('✅ Test 2: Vodoravna linija 10 ograj');
|
||||
|
||||
// TESTNI PRIMER 3: Navpična linija ograj (10 ograj)
|
||||
for (let i = 0; i < 10; i++) {
|
||||
this.buildSystem.placeSingleFence(43, 48 + i, 'fence_vertical', false);
|
||||
}
|
||||
console.log('✅ Test 3: Navpična linija 10 ograj');
|
||||
|
||||
// TESTNI PRIMER 4: Majhen pravokotnik (8x6)
|
||||
this.buildSystem.placeFenceRectangle(60, 45, 8, 6, 'fence_post', false);
|
||||
console.log('✅ Test 4: Pravokotnik 8x6 ograj');
|
||||
|
||||
// TESTNI PRIMER 5: Diagonalna linija (Bresenham)
|
||||
this.buildSystem.placeFenceLine(30, 30, 40, 40, 'fence_corner', false);
|
||||
console.log('✅ Test 5: Diagonalna linija ograj');
|
||||
|
||||
// TESTNI PRIMER 6: Večji pravokotnik (20x15)
|
||||
this.buildSystem.placeFenceRectangle(20, 60, 20, 15, 'fence_horizontal', false);
|
||||
console.log('✅ Test 6: Velik pravokotnik 20x15 ograj');
|
||||
|
||||
// TESTNI PRIMER 7: Različni tipi ograj v vrsti
|
||||
this.buildSystem.placeSingleFence(70, 50, 'fence', false);
|
||||
this.buildSystem.placeSingleFence(71, 50, 'fence_post', false);
|
||||
this.buildSystem.placeSingleFence(72, 50, 'fence_horizontal', false);
|
||||
this.buildSystem.placeSingleFence(73, 50, 'fence_vertical', false);
|
||||
this.buildSystem.placeSingleFence(74, 50, 'fence_corner', false);
|
||||
console.log('✅ Test 7: Vsi 5 tipov ograj v vrsti');
|
||||
|
||||
console.log('🎉 VSI TESTNI PRIMERI KONČANI! Preveri mapo za ograje.');
|
||||
|
||||
// ========================================================
|
||||
// OPOMBE:
|
||||
// - Zadnji parameter (false) pomeni, da se viri NE porabijo
|
||||
// - Spremeni v (true), če želiš testirati porabo virov
|
||||
// - Koordinate so v grid sistemu (0-99)
|
||||
// - Ograje se prikažejo takoj po nalaganju igre
|
||||
// ========================================================
|
||||
200
archive/tests/VIDEO_CHARACTER_TEST.js
Normal file
200
archive/tests/VIDEO_CHARACTER_TEST.js
Normal file
@@ -0,0 +1,200 @@
|
||||
// VIDEO KARAKTER - TEST CODE
|
||||
// Uporabi video kot texture za player sprite
|
||||
|
||||
// METODA 1: VIDEO SPRITE KOT KARAKTER (ENOSTAVNO)
|
||||
// ================================================
|
||||
|
||||
// V GameScene.js preload():
|
||||
preload() {
|
||||
// Load video
|
||||
this.load.video('player_video', 'assets/videos/[IME_TVOJEGA_VIDEA].mp4');
|
||||
}
|
||||
|
||||
// V GameScene.js create() - NAMESTO obstoječega playerja:
|
||||
create() {
|
||||
// ... existing code ...
|
||||
|
||||
// VIDEO PLAYER (namesto sprite)
|
||||
const playerX = 400;
|
||||
const playerY = 300;
|
||||
|
||||
// Create video
|
||||
this.playerVideo = this.add.video(playerX, playerY, 'player_video');
|
||||
this.playerVideo.setOrigin(0.5, 1); // Bottom center
|
||||
this.playerVideo.setScale(0.5); // Adjust size
|
||||
this.playerVideo.setDepth(100);
|
||||
this.playerVideo.play(true); // Loop
|
||||
|
||||
// Store position for movement
|
||||
this.playerPos = { x: 20, y: 20 }; // Grid position
|
||||
|
||||
// Camera follow video
|
||||
this.cameras.main.startFollow(this.playerVideo);
|
||||
}
|
||||
|
||||
// V GameScene.js update() - MOVEMENT:
|
||||
update(time, delta) {
|
||||
if (!this.playerVideo) return;
|
||||
|
||||
// WASD movement
|
||||
const speed = 2;
|
||||
let moved = false;
|
||||
|
||||
if (this.cursors.left.isDown || this.input.keyboard.addKey('A').isDown) {
|
||||
this.playerPos.x -= speed * (delta / 16);
|
||||
moved = true;
|
||||
}
|
||||
if (this.cursors.right.isDown || this.input.keyboard.addKey('D').isDown) {
|
||||
this.playerPos.x += speed * (delta / 16);
|
||||
moved = true;
|
||||
}
|
||||
if (this.cursors.up.isDown || this.input.keyboard.addKey('W').isDown) {
|
||||
this.playerPos.y -= speed * (delta / 16);
|
||||
moved = true;
|
||||
}
|
||||
if (this.cursors.down.isDown || this.input.keyboard.addKey('S').isDown) {
|
||||
this.playerPos.y += speed * (delta / 16);
|
||||
moved = true;
|
||||
}
|
||||
|
||||
// Update video position (isometric)
|
||||
if (moved) {
|
||||
const screenPos = this.iso.toScreen(this.playerPos.x, this.playerPos.y);
|
||||
this.playerVideo.setPosition(screenPos.x, screenPos.y);
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================
|
||||
// METODA 2: VIDEO TEXTURE (ADVANCED)
|
||||
// ================================================
|
||||
|
||||
// V create():
|
||||
create() {
|
||||
// Create video (hidden)
|
||||
const video = this.add.video(0, 0, 'player_video');
|
||||
video.setVisible(false);
|
||||
video.play(true);
|
||||
|
||||
// Create sprite using video as texture
|
||||
this.player = this.add.sprite(400, 300, video);
|
||||
this.player.setOrigin(0.5, 1);
|
||||
this.player.setScale(0.5);
|
||||
this.player.setDepth(100);
|
||||
|
||||
// Camera follow
|
||||
this.cameras.main.startFollow(this.player);
|
||||
}
|
||||
|
||||
// ================================================
|
||||
// METODA 3: VIDEO + PHYSICS (COLLISION)
|
||||
// ================================================
|
||||
|
||||
// V create():
|
||||
create() {
|
||||
// Create video player
|
||||
this.playerVideo = this.add.video(400, 300, 'player_video');
|
||||
this.playerVideo.setOrigin(0.5, 1);
|
||||
this.playerVideo.setScale(0.5);
|
||||
this.playerVideo.setDepth(100);
|
||||
this.playerVideo.play(true);
|
||||
|
||||
// Add physics (for collision)
|
||||
this.physics.add.existing(this.playerVideo);
|
||||
this.playerVideo.body.setCollideWorldBounds(true);
|
||||
|
||||
// Camera follow
|
||||
this.cameras.main.startFollow(this.playerVideo);
|
||||
}
|
||||
|
||||
// V update() - Physics movement:
|
||||
update(time, delta) {
|
||||
if (!this.playerVideo) return;
|
||||
|
||||
const speed = 200;
|
||||
|
||||
// Reset velocity
|
||||
this.playerVideo.body.setVelocity(0);
|
||||
|
||||
// WASD movement
|
||||
if (this.cursors.left.isDown) {
|
||||
this.playerVideo.body.setVelocityX(-speed);
|
||||
}
|
||||
if (this.cursors.right.isDown) {
|
||||
this.playerVideo.body.setVelocityX(speed);
|
||||
}
|
||||
if (this.cursors.up.isDown) {
|
||||
this.playerVideo.body.setVelocityY(-speed);
|
||||
}
|
||||
if (this.cursors.down.isDown) {
|
||||
this.playerVideo.body.setVelocityY(speed);
|
||||
}
|
||||
}
|
||||
|
||||
// ================================================
|
||||
// QUICK TEST (NAJHITREJŠI NAČIN)
|
||||
// ================================================
|
||||
|
||||
// V GameScene.js create() - DODAJ NA KONEC:
|
||||
// TEST: Video player
|
||||
const testVideo = this.add.video(
|
||||
this.cameras.main.centerX,
|
||||
this.cameras.main.centerY,
|
||||
'player_video'
|
||||
);
|
||||
testVideo.setOrigin(0.5);
|
||||
testVideo.setScale(0.5); // Adjust size
|
||||
testVideo.setDepth(1000); // Above everything
|
||||
testVideo.play(true); // Loop
|
||||
|
||||
// Move with arrow keys
|
||||
this.input.keyboard.on('keydown', (event) => {
|
||||
const speed = 10;
|
||||
if (event.key === 'ArrowLeft') testVideo.x -= speed;
|
||||
if (event.key === 'ArrowRight') testVideo.x += speed;
|
||||
if (event.key === 'ArrowUp') testVideo.y -= speed;
|
||||
if (event.key === 'ArrowDown') testVideo.y += speed;
|
||||
});
|
||||
|
||||
console.log('🎬 Video player test ready! Use arrow keys to move.');
|
||||
|
||||
// ================================================
|
||||
// TIPS:
|
||||
// ================================================
|
||||
|
||||
// 1. Video size:
|
||||
testVideo.setDisplaySize(64, 64); // Fixed size
|
||||
testVideo.setScale(0.5); // Scale
|
||||
|
||||
// 2. Video loop:
|
||||
testVideo.setLoop(true); // Loop
|
||||
testVideo.setLoop(false); // Play once
|
||||
|
||||
// 3. Video speed:
|
||||
testVideo.setPlaybackRate(1.5); // 1.5x speed
|
||||
testVideo.setPlaybackRate(0.5); // 0.5x speed
|
||||
|
||||
// 4. Video flip:
|
||||
testVideo.setFlipX(true); // Flip horizontally
|
||||
testVideo.setFlipY(true); // Flip vertically
|
||||
|
||||
// 5. Video alpha:
|
||||
testVideo.setAlpha(0.8); // Semi-transparent
|
||||
|
||||
// 6. Video tint:
|
||||
testVideo.setTint(0xff0000); // Red tint
|
||||
|
||||
// ================================================
|
||||
// ZAMENJAJ IME VIDEA:
|
||||
// ================================================
|
||||
// 'player_video' -> ime tvojega MP4 filea (brez .mp4)
|
||||
// Primer: če je file 'character.mp4', uporabi 'character'
|
||||
|
||||
// ================================================
|
||||
// TESTING:
|
||||
// ================================================
|
||||
// 1. Zaženi igro
|
||||
// 2. Vidiš video kot karakter
|
||||
// 3. Premikaj z arrow keys ali WASD
|
||||
// 4. Video se loopa
|
||||
|
||||
console.log('🎬 Video character test code ready!');
|
||||
18
archive/tests/clear_all_saves.js
Normal file
18
archive/tests/clear_all_saves.js
Normal file
@@ -0,0 +1,18 @@
|
||||
// CLEAR ALL SAVE FILES
|
||||
console.log('🗑️ Clearing ALL save files...');
|
||||
|
||||
// Clear main save
|
||||
localStorage.removeItem('novafarma_savefile');
|
||||
|
||||
// Clear all slots
|
||||
for (let i = 1; i <= 3; i++) {
|
||||
localStorage.removeItem(`novafarma_save_slot${i}`);
|
||||
localStorage.removeItem(`novafarma_slot${i}_meta`);
|
||||
}
|
||||
|
||||
// Clear other saves
|
||||
localStorage.removeItem('novafarma_save');
|
||||
localStorage.removeItem('novafarma_achievement_progress');
|
||||
|
||||
console.log('✅ All saves cleared! Reload page (F4) for fresh start.');
|
||||
console.log('📝 Remaining keys:', Object.keys(localStorage).filter(k => k.includes('novafarma')));
|
||||
3
archive/tests/clear_save.js
Normal file
3
archive/tests/clear_save.js
Normal file
@@ -0,0 +1,3 @@
|
||||
// Clear localStorage save file
|
||||
localStorage.removeItem('novafarma_savefile');
|
||||
console.log('✅ Save file cleared! Reload page (F4) for fresh start.');
|
||||
10
archive/tests/test_water_animation.js
Normal file
10
archive/tests/test_water_animation.js
Normal file
@@ -0,0 +1,10 @@
|
||||
// Test: Check if water frames exist
|
||||
console.log('Testing water animation frames...');
|
||||
|
||||
// Check water_frame_0 through water_frame_3
|
||||
for (let i = 0; i < 4; i++) {
|
||||
const key = `water_frame_${i}`;
|
||||
console.log(`Frame ${i}: ${key}`);
|
||||
}
|
||||
|
||||
console.log('Water animation test complete!');
|
||||
Reference in New Issue
Block a user