Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_ghosthouse_jackolantern_merciful_old_Step_0

(view raw script w/o annotations or w/e)
1
timer++;
2
if (scare_con >= 1)
3
{
4
    if (scare_con == 1 && timer >= 10)
5
        event_user(1);
6
    if (scare_con == 2 && timer >= 35)
7
    {
8
        event_user(1);
9
        obj_jackenstein_enemy.spooked = true;
10
        with (instance_create(x - 145, y + 80, obj_takingtoolong))
11
            bright = 1;
12
        snd_play(snd_your_too_bright);
13
    }
14
    if (scare_con == 3 && timer >= 75)
15
    {
16
        timer = 0;
17
        scare_con = -1;
18
    }
19
    if (scare_con >= 1)
20
        exit;
21
}
22
if (ticks < 0)
23
{
24
    ticks += 1;
25
}
26
else if (point_distance(x, y, obj_heart.x + 4, obj_heart.y + 4) < light_distance && alarm[0]
 == -1)
gml_Object_obj_ghosthouse_jackolantern_merciful_old_Alarm_0.gml

sprite_index = spr_jackolantern_cry; image_speed = 0.25;
27
{
28
    if (!feared && scare_con == 0)
29
    {
30
        speed = 0;
31
        sound_play(snd_bluh);
32
        scare_con = 1;
33
        exit;
34
    }
35
    ticks += 0.2;
36
    if (ticks >= 1)
37
    {
38
        ticks = -45;
39
        completed_ticks++;
40
        if (!feared)
41
        {
42
            feared = true;
43
            alarm[0]
 = 30;
gml_Object_obj_ghosthouse_jackolantern_merciful_old_Alarm_0.gml

sprite_index = spr_jackolantern_cry; image_speed = 0.25;
44
            sprite_index = spr_jackolantern_stunned;
45
            event_user(0);
46
        }
47
        sound_play(snd_bluh);
48
        with (obj_jackenstein_enemy)
49
        {
50
            if (!i_ex(obj_dmgwriter_boogie))
51
            {
52
                global.mercymod[myself] += 7;
53
                __mercydmgwriter = instance_create_depth(global.monsterx[myself], global.monstery[myself] + 40, depth - 99999, obj_dmgwriter_boogie);
54
                __mercydmgwriter.damage = 7;
55
                __mercydmgwriter.type = 5;
56
                global.hittarget[myself]++;
57
                snd_play_x(snd_mercyadd, 0.8, 1.4);
58
            }
59
            else if (global.mercymod[myself] < 100)
60
            {
61
                obj_dmgwriter_boogie.damage += 7;
62
                obj_dmgwriter_boogie.init = 0;
63
                global.mercymod[myself] += 7;
64
            }
65
            if (global.mercymod[myself] > 100)
66
            {
67
                if (i_ex(obj_dmgwriter_boogie))
68
                    obj_dmgwriter_boogie.damage -= (global.mercymod[myself] - 100);
69
                global.mercymod[myself] = 100;
70
            }
71
        }
72
        if (completed_ticks == run_threshold)
73
        {
74
            global.turntimer = 30;
75
            targ_x = xstart;
76
            targ_y = ystart;
77
            speed = 5;
78
            friction = 0.1;
79
            direction = point_direction(x, y, targ_x, targ_y);
80
        }
81
    }
82
}
83
if (completed_ticks < run_threshold)
84
{
85
    if (feared && alarm[0]
 == -1)
gml_Object_obj_ghosthouse_jackolantern_merciful_old_Alarm_0.gml

sprite_index = spr_jackolantern_cry; image_speed = 0.25;
86
    {
87
        reset_timer++;
88
        if (reset_timer > 90 || point_distance(x, y, targ_x, targ_y) < 15)
89
        {
90
            event_user(0);
91
            reset_timer = 0;
92
        }
93
        speed = 3 + log2(max(1, abs(ticks))) + completed_ticks;
94
        direction = point_direction(x, y, targ_x, targ_y);
95
    }
96
    else if (alarm[0])
97
    {
98
        speed *= 0.95;
99
        speed -= 0.125;
100
    }
101
    else
102
    {
103
        speed = min(sqrt(max(0, timer - 30)), 4) / (1 + ticks + completed_ticks);
104
        direction = 
scr_at_player
scr_at_player

function
scr_at_player(arg0 = x, arg1 = y)
{ return point_direction(arg0, arg1, obj_heart.x + (obj_heart.sprite_width / 2), obj_heart.y + (obj_heart.sprite_height / 2)); }
(x, y);
105
    }
106
}