62 lines
1.8 KiB
JavaScript
62 lines
1.8 KiB
JavaScript
/**
|
|
* BasementScene.js - EXAMPLE
|
|
*
|
|
* Game opening scene - Kai wakes up in basement
|
|
* FIRST WEATHER INTEGRATION - Wind blows hair from frame 1!
|
|
*
|
|
* This is an EXAMPLE showing how to integrate weather into any scene
|
|
*/
|
|
|
|
import BaseScene from './BaseScene.js';
|
|
|
|
export default class BasementScene extends BaseScene {
|
|
constructor() {
|
|
super({ key: 'BasementScene' });
|
|
}
|
|
|
|
create() {
|
|
// 1. INITIALIZE WEATHER FIRST!
|
|
// Basement = enclosed space, light draft
|
|
this.initWeather('basement');
|
|
this.weather.windSystem.setWindStrength(0.2); // Gentle indoor draft
|
|
|
|
// 2. Create player character
|
|
this.kai = this.add.sprite(400, 300, 'kai_idle');
|
|
|
|
// 3. Create hair layer (separate sprite for wind effect)
|
|
this.kaiHair = this.add.sprite(400, 280, 'kai_dreads');
|
|
|
|
// 4. APPLY WIND TO HAIR - This makes it move!
|
|
this.weather.windSystem.applyWindToSprite(this.kaiHair, 'hair');
|
|
|
|
// NOW: Hair sways gently from FIRST FRAME!
|
|
// Player immediately sees: "Game is alive!"
|
|
|
|
// 5. Add some basement props with wind
|
|
const cobweb = this.add.sprite(100, 50, 'cobweb');
|
|
this.weather.windSystem.applyWindToSprite(cobweb, 'grass'); // Cobwebs sway like grass
|
|
|
|
// 6. Kai wakes up dialogue
|
|
this.time.delayedCall(1000, () => {
|
|
this.showDialogue("...kje sm? Glava me boli...");
|
|
});
|
|
|
|
// 7. Tutorial: Player notices hair moving
|
|
this.time.delayedCall(3000, () => {
|
|
this.showDialogue("...veter? V kleti?");
|
|
});
|
|
}
|
|
|
|
update(time, delta) {
|
|
// Update weather every frame
|
|
this.updateWeather(delta);
|
|
|
|
// Rest of game logic...
|
|
}
|
|
|
|
showDialogue(text) {
|
|
// Dialogue system integration
|
|
console.log(`Kai: ${text}`);
|
|
}
|
|
}
|