Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_musicguys_thingy_Step_0

(view raw script w/o annotations or w/e)
1
timer++;
2
image_alpha = 0.25;
3
if (instance_exists(obj_growtangle))
4
{
5
    if (x >= ((obj_growtangle.x + (obj_growtangle.sprite_width / 2)) - 16))
6
    {
7
        hspeed = -abs(hspeed);
8
        x -= 4;
9
    }
10
    if (x <= (obj_growtangle.x - (obj_growtangle.sprite_width / 2)))
11
    {
12
        hspeed = abs(hspeed);
13
        x += 4;
14
    }
15
}
16
if (mode == 0)
17
{
18
    if (timer >= 30)
19
    {
20
        with (obj_heart)
21
            wspeed = 5;
22
        bul = instance_create(x, 480, obj_collidebullet);
23
        bul.sprite_index = spr_musicenemy_musicbar;
24
        bul.vspeed = -4;
25
        bul.active = 1;
26
        bul.mask_index = spr_musicenemy_musicbar_mask;
27
        hspeed = random_range(-3, 3);
28
        timer = 0;
29
    }
30
}
31
if (mode == 1)
32
{
33
    if (timer >= 14)
34
    {
35
        with (obj_heart)
36
            wspeed = 6;
37
        triple = choose(0, 1);
38
        triple = 1;
39
        if (triple == 1)
40
        {
41
            event_user(0);
42
            with (bul[choose(0, 1, 2)])
43
                instance_destroy();
44
        }
45
        if (triple == 0)
46
        {
47
            bul = instance_create(x, 480, obj_collidebullet);
48
            bul.sprite_index = spr_musicenemy_damagebox;
49
            bul.x = obj_growtangle.x + choose(-15, 15);
50
            bul.gravity = -0.1;
51
            bul.vspeed = -4;
52
            bul.image_yscale = 8;
53
            bul.image_xscale = 1.5;
54
            bul.active = 1;
55
        }
56
        hspeed = random_range(-4, 4);
57
        timer = 0;
58
    }
59
}
60
if (input_memorizer == 1)
61
{
62
    with (obj_heart)
63
        wspeed = 8;
64
    timer = 0;
65
    input_memorizer = 2;
66
    framecount = 0;
67
    pressed[0] = 0;
68
    pressed[1] = 0;
69
    pressed[2] = 0;
70
    mybutton[0] = ord("Z");
71
    mybutton[1] = ord("X");
72
    mybutton[2] = ord("C");
73
    remframecount[0] = 0;
74
    remframecount[1] = 0;
75
    remframecount[2] = 0;
76
    for (i = 0; i < 3; i++)
77
    {
78
        for (j = 0; j < 3; j++)
79
            mybul[i][j] = -1;
80
    }
81
    file = file_text_open_write("bulletpattern.txt");
82
}
83
if (input_memorizer == 2)
84
{
85
    framecount++;
86
    timer = 0;
87
    if (keyboard_check_pressed(vk_space))
88
        file_text_close(file);
89
    makebullet = 0;
90
    which = 0;
91
    for (i = 0; i < 3; i++)
92
    {
93
        if (keyboard_check(mybutton[i]) && pressed[i] == 1)
94
        {
95
            with (mybul[i][0])
96
                image_yscale += 0.5;
97
            with (mybul[i][1])
98
                image_yscale += 0.5;
99
            with (mybul[i][2])
100
                image_yscale += 0.5;
101
        }
102
        if (keyboard_check(mybutton[i]) && pressed[i] == 0)
103
        {
104
            remframecount[i] = framecount;
105
            event_user(0);
106
            mybul[i][0] = bul[0];
107
            mybul[i][1] = bul[1];
108
            mybul[i][2] = bul[2];
109
            with (bul[i])
110
                instance_destroy();
111
            pressed[i] = 1;
112
        }
113
        if (keyboard_check_released(mybutton[i]))
114
        {
115
            finalheight = 1;
116
            if (i_ex(mybul[i][0]))
117
                finalheight = mybul[i][0].image_yscale;
118
            if (i_ex(mybul[i][1]))
119
                finalheight = mybul[i][1].image_yscale;
120
            if (i_ex(mybul[i][2]))
121
                finalheight = mybul[i][2].image_yscale;
122
            file_text_write_real(file, remframecount[i]);
123
            file_text_write_string(file, ",");
124
            file_text_write_real(file, i);
125
            file_text_write_string(file, ",");
126
            file_text_write_real(file, finalheight);
127
            file_text_writeln(file);
128
            pressed[i] = 0;
129
        }
130
    }
131
}
132
if (mode == 3)
133
{
134
    if (mframecount >= remframe)
135
    {
136
        event_user(0);
137
        bul[0].image_yscale = bullet_height[bulletcount];
138
        bul[1].image_yscale = bullet_height[bulletcount];
139
        bul[2].image_yscale = bullet_height[bulletcount];
140
        with (bul[bullet_pos[bulletcount]])
141
            instance_destroy();
142
        bulletcount++;
143
        remframe = bullet_frame[bulletcount];
144
    }
145
    mframecount++;
146
    if (bulletcount >= bulletmax)
147
    {
148
        bulletcount = 0;
149
        mframecount = 0;
150
        remframe = 15;
151
    }
152
}