makefuture / games / accept-the-cookie / game / scenes / Zone2Scene.js
228 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
51
52
53
54
55
56
57
58
59
60
61
import { BaseZoneScene } from './BaseZoneScene.js?v=20260427c';
import { recordLurk, recordPost } from '../systems/behavioral.js?v=20260427c';
import { ZONE_DEFINITIONS } from '../systems/session.js?v=20260427c';

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

    buildVerticalLevel() {
        super.buildVerticalLevel();
        for (let y = this.levelHeight - 360; y > 220; y -= 520) {
            this.addSocialHub(y);
        }
    }

    addSocialHub(y) {
        const x = this.scale.width * 0.5;
        const post = this.add.rectangle(x - 80, y, 116, 42, 0xff2d95, 0.95);
        const lurk = this.add.rectangle(x + 80, y, 116, 42, 0x241233, 0.95);
        this.add.text(post.x, y, 'POST', { fontFamily: 'system-ui', fontSize: '12px', color: '#fff', fontStyle: '700' }).setOrigin(0.5);
        this.add.text(lurk.x, y, 'LURK', { fontFamily: 'system-ui', fontSize: '12px', color: '#fff', fontStyle: '700' }).setOrigin(0.5);
        this.physics.add.existing(post, true);
        this.physics.add.existing(lurk, true);
        this.time.delayedCall(50, () => {
            if (!this.player) return;
            this.physics.add.overlap(this.player.sprite, post, () => {
                if (post.used) return;
                post.used = true;
                recordPost(this.session);
                this.session.currencies.cookies += 35;
                this.algorithm.say('Your friends are helping. They are also expanding your social graph.');
            });
            this.physics.add.overlap(this.player.sprite, lurk, () => {
                if (lurk.used) return;
                lurk.used = true;
                recordLurk(this.session);
                this.algorithm.say('Lurking is private. It is also lonely, and there is no save animation.');
            });
        });
    }

    zonePrompts() {
        return [
            {
                at: 12,
                key: 'Sync contacts',
                title: 'Sync your contacts?',
                copy: 'Find friends, boost your score, and make the feed feel alive.',
                accept: 'Sync',
                decline: 'Skip',
                onAccept: () => {
                    this.session.flags.syncedContacts = true;
                    this.session.currencies.cookies += 30;
                    recordPost(this.session);
                    this.algorithm.say('Wonderful. Your friends made the experience better for everyone watching.');
                },
            },
        ];
    }
}

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