35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
// 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!
|