Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_dogcheck2_Draw_0

(view raw script w/o annotations or w/e)
1
trackpos = audio_sound_get_track_position(global.currentsong[1]);
2
if (keyboard_check_pressed(ord("R")))
3
    room_restart();
4
if (keyboard_check_pressed(ord("N")))
5
    audio_sound_set_track_position(global.currentsong[1], 10);
6
if (maindog == 0)
7
{
8
    maindog = instance_create(0, 120, obj_marker);
9
    maindog.sprite_index = spr_dogcar;
10
    maindog.hspeed = 5;
11
    maindog.image_xscale = -1;
12
    maindog.image_yscale = 1;
13
    maindog.image_speed = 0.25;
14
    with (maindog)
15
        scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
16
}
17
trigpoint = 11.375;
18
if ((trackpos >= (trigpoint - 0.03) && trackpos <= (trigpoint + 0.01)) || (trackpos >= (trigpoint - 0.03) && trackpos <= (trigpoint + 0.01)))
19
{
20
    var dognum = irandom_range(4, 8);
21
    for (var i = 0; i < dognum; i++)
22
    {
23
        var newdog = instance_create(0, 120 + random_range(-40, 40), obj_marker);
24
        newdog.sprite_index = spr_dogcar;
25
        newdog.hspeed = random_range(5, 8);
26
        newdog.image_xscale = -0.5;
27
        newdog.image_yscale = 0.5;
28
        newdog.friction = random_range(0.01, -0.01);
29
        newdog.image_speed = ((hspeed / 4) * 0.25) + 0.25;
30
        with (newdog)
31
            scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
32
    }
33
}
34
trigpoint = 14;
35
if ((trackpos >= (trigpoint - 0.03) && trackpos <= (trigpoint + 0.01)) || (trackpos >= (trigpoint - 0.03) && trackpos <= (trigpoint + 0.01)))
36
{
37
    var dognum = irandom_range(5, 12);
38
    for (var i = 0; i < dognum; i++)
39
    {
40
        var newdog = instance_create(320, 120 + random_range(-40, 40), obj_marker);
41
        newdog.sprite_index = spr_dogcar;
42
        newdog.hspeed = -random_range(5, 8);
43
        newdog.image_xscale = 0.5;
44
        newdog.image_yscale = 0.5;
45
        newdog.friction = random_range(0.01, -0.01);
46
        newdog.image_speed = ((hspeed / 4) * 0.25) + 0.25;
47
        with (newdog)
48
            scr_depth
scr_depth

function scr_depth() { depth = 100000 - ((y * 10) + (sprite_height * 10)); }
();
49
    }
50
}
51
if (i_ex(obj_marker))
52
{
53
    with (obj_marker)
54
    {
55
        if (x > 384)
56
        {
57
            if (id != other.maindog)
58
                instance_destroy();
59
        }
60
    }
61
}
62
with (maindog)
63
{
64
    trigpoint = 2.74;
65
    if (other.trackpos >= (trigpoint - 0.03) && other.trackpos <= (trigpoint + 0.01))
66
    {
67
        hspeed = -5;
68
        image_xscale = -sign(hspeed);
69
        x = 320;
70
    }
71
    trigpoint = 5.643;
72
    if (other.trackpos >= (trigpoint - 0.03) && other.trackpos <= (trigpoint + 0.01))
73
    {
74
        hspeed = 5;
75
        image_xscale = -sign(hspeed);
76
        x = 0;
77
    }
78
    trigpoint = 8.653;
79
    if (other.trackpos >= (trigpoint - 0.03) && other.trackpos <= (trigpoint + 0.01))
80
    {
81
        hspeed = -5;
82
        image_xscale = -sign(hspeed);
83
        x = 320;
84
    }
85
    trigpoint = 11.375;
86
    if (other.trackpos >= (trigpoint - 0.03) && other.trackpos <= (trigpoint + 0.01))
87
    {
88
        hspeed = 6;
89
        image_xscale = -sign(hspeed);
90
        x = 0;
91
    }
92
    trigpoint = 14;
93
    if (other.trackpos >= (trigpoint - 0.03) && other.trackpos <= (trigpoint + 0.01))
94
    {
95
        hspeed = -6;
96
        image_xscale = -sign(hspeed);
97
        x = 320;
98
    }
99
    trigpoint = 16.557;
100
    if (other.trackpos >= (trigpoint - 0.03) && other.trackpos <= (trigpoint + 0.01))
101
    {
102
        hspeed = 4;
103
        image_xscale = -sign(hspeed);
104
        x = 0;
105
    }
106
}