makefuture / games / accept-the-cookie / game / scenes / Zone4Scene.js
206 words
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import { BaseZoneScene } from './BaseZoneScene.js?v=20260427c';
import { dominantDirection } from '../systems/behavioral.js?v=20260427c';
import { ZONE_DEFINITIONS } from '../systems/session.js?v=20260427c';

export class Zone4Scene extends BaseZoneScene {
    constructor() {
        super('Zone4Scene', ZONE_DEFINITIONS[3]);
    }

    buildHorizontalLevel() {
        super.buildHorizontalLevel();
        for (let x = 640; x < this.levelWidth - 240; x += 380) {
            const top = 120 + (x % 3) * 40;
            this.add.rectangle(x, top, 1, this.scale.height - 230, 0x61f3ff, 0.28);
            this.add.circle(x, top + 80, 8, 0x61f3ff, 0.65);
        }
    }

    spawnZoneThreats(time) {
        if (!this.nextPredictionAt) this.nextPredictionAt = time + 1800;
        if (time < this.nextPredictionAt) return;
        this.nextPredictionAt = time + 1900;
        const direction = dominantDirection(this.session);
        const ahead = direction === 'left' ? 145 : direction === 'right' ? 230 : 185;
        const x = this.player.sprite.x + ahead;
        const y = Math.max(120, Math.min(this.scale.height - 160, this.player.sprite.y - 45));
        const wall = this.add.rectangle(x, y, 28, 130, 0xffffff, 0.75);
        this.hazards.add(wall);
        wall.body.setSize(28, 130);
        this.algorithm.say(`I notice you prefer ${direction}. Optimizing the path.`);
    }

    zonePrompts() {
        return [
            {
                at: 8,
                key: 'Enable personalization',
                title: 'Enable personalization?',
                copy: 'Let the experience adapt to you. Platforms, prompts, and obstacles may become more relevant.',
                accept: 'Enable',
                decline: 'Keep default',
                onAccept: () => {
                    this.session.flags.personalized = true;
                    this.session.currencies.cookies += 45;
                    this.algorithm.say('Thank you. Your defaults have been replaced with destiny.');
                },
            },
        ];
    }
}

static mirror of HEAD · about · clone: git clone https://git.makefuture.ro/makefuture.git