Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_homealone_treat_catcher_Step_0

(view raw script w/o annotations or w/e)
1
if (!i_ex(obj_homealone_heart))
2
    exit;
3
if (hit_heart)
4
{
5
    hit_timer++;
6
    if (hit_timer == 1)
7
    {
8
        global.interact = 1;
9
        image_index = 1;
10
        snd_play(snd_hurt1);
11
        snd_play(snd_wing);
12
        with (obj_homealone_heart)
13
        {
14
            image_angle = -45;
15
            hspeed = 6;
16
            gravity = 2;
17
        }
18
    }
19
    if (hit_timer == 8)
20
    {
21
        with (obj_homealone_heart)
22
        {
23
            gravity = 0;
24
            vspeed = 0;
25
            friction = 0.5;
26
        }
27
    }
28
    if (hit_timer == 10)
29
    {
30
        with (obj_homealone_heart)
31
            hspeed = 0;
32
    }
33
    if (hit_timer == 26)
34
    {
35
        image_index = 0;
36
        snd_play(snd_noise);
37
        global.interact = 0;
38
        with (obj_homealone_heart)
39
            image_angle = 0;
40
        hit_heart = false;
41
    }
42
}
43
else if (!hit_active)
44
{
45
    if (point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, x, y - (sprite_height / 2) - 8, x + (sprite_width / 2), (y - (sprite_height / 2)) + 8))
46
    {
47
        hit_heart = true;
48
        hit_active = true;
49
    }
50
}
51
else if (!point_in_rectangle(obj_homealone_heart.x, obj_homealone_heart.y, x, y - (sprite_height / 2) - 8, x + (sprite_width / 2), (y - (sprite_height / 2)) + 8))
52
{
53
    hit_active = false;
54
    hit_timer = 0;
55
}