Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_scoreAdder_Step_0

(view raw script w/o annotations or w/e)
1
if (init == 0)
2
{
3
    scoreleft = scoreamount;
4
    mysign = sign(scoreamount);
5
    init = 1;
6
    if (mysign < 0)
7
    {
8
        if (i_ex(obj_board_scoreboard))
9
        {
10
            with (obj_board_scoreboard)
11
                image_blend = #E33D47;
12
            
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
(554);
13
        }
14
    }
15
    if (modamt == 5)
16
    {
17
        if (abs(scoreamount) >= 100)
18
            modamt = 10;
19
        if (abs(scoreamount) >= 1000)
20
            modamt = 100;
21
    }
22
}
23
if (init == 1)
24
{
25
    timer++;
26
    if (scoreleft != 0)
27
    {
28
        if (scoreleft > 0)
29
            snd_play_pitch(mysnd, 1);
30
        if (scoreleft < 0)
31
            snd_play_pitch(mysnd, 0.8);
32
        if (mysign > 0)
33
        {
34
            if (scoreleft > modamt)
35
            {
36
                scoreleft -= modamt;
37
                global.flag[1044 points] += modamt;
38
                global.flag[1117 points_spent] += modamt;
39
            }
40
            else
41
            {
42
                global.flag[1044 points] += scoreleft;
43
                global.flag[1117 points_spent] += scoreleft;
44
                scoreleft = 0;
45
            }
46
        }
47
        if (mysign < 0)
48
        {
49
            if (scoreleft < -modamt)
50
            {
51
                scoreleft += modamt;
52
                global.flag[1044 points] -= modamt;
53
                global.flag[1117 points_spent] -= modamt;
54
            }
55
            else
56
            {
57
                global.flag[1044 points] += scoreleft;
58
                global.flag[1117 points_spent] += scoreleft;
59
                scoreleft = 0;
60
            }
61
        }
62
    }
63
    else
64
    {
65
        with (obj_board_scoreboard)
66
            image_blend = c_white;
67
        instance_destroy();
68
    }
69
}