Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_ch2_keyboardpuzzle_tile_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    if (global.lang == "ja" && jaString != "-")
4
        myString = jaString;
5
    if (myString == "!")
6
        textImage = 36;
7
    else if (ord(myString) <= 57)
8
        textImage = ord(myString) - 22;
9
    else
10
        textImage = ord(string_upper(myString)) - 65;
11
    init = 1;
12
}
13
var checkPress = 0;
14
if (i_ex(obj_mainchara) && pressable && global.interact == 0)
15
{
16
    if (place_meeting(x, y, obj_mainchara))
17
        checkPress = 1;
18
}
19
if (checkPress)
20
{
21
    if (pressed == 0)
22
    {
23
        pressedBuffer = 2;
24
        pressed = 1;
25
        with (obj_ch2_keyboardpuzzle_speaker)
26
            image_timer = 7;
27
        if (myString == "A" && irandom(99) == 0)
28
            snd_play(snd_txtsans);
29
        else if (myString == "!")
30
            snd_play(snd_speak_and_spell_Exclamation);
31
        else
32
            snd_play(asset_get_index("snd_speak_and_spell_" + myString));
33
        obj_ch2_keyboardpuzzle_controller.addString = myString;
34
        obj_ch2_keyboardpuzzle_controller.lastPressedTile = id;
35
        with (obj_ch2_keyboardpuzzle_controller)
36
            event_user(0);
37
    }
38
}
39
else if (pressable && global.interact == 0)
40
{
41
    if (pressedBuffer <= 0)
42
        pressed = 0;
43
}
44
pressedBuffer--;
45
if (bouncecon > 0)
46
{
47
    if (bouncecon == 1)
48
    {
49
        drawY = 0;
50
        bouncetimer = 0;
51
        bouncecon = 2;
52
    }
53
    if (bouncecon == 2)
54
    {
55
        pressed = 0;
56
        drawY = -30;
57
        bouncecon = 3;
58
    }
59
    if (bouncecon == 3)
60
    {
61
        drawY = lerp(drawY, 0, 0.25);
62
        bouncetimer++;
63
        if (bouncetimer >= 15)
64
        {
65
            bouncetimer = 0;
66
            bouncecon = 0;
67
            drawY = 0;
68
        }
69
    }
70
}