Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_attack_green_cookingtime_Draw_0

related scripts: CleanUp_0Create_0Draw_0

(view raw script w/o annotations or w/e)
1
with (obj_green_enemy)
2
{
3
    x = other.x;
4
    y = other.y;
5
}
6
var timermax = 12;
7
var location_i = choose(0, 1, 2);
8
var location_x = 0;
9
var location_count = 3;
10
if (i_ex(obj_orange_green_controller))
11
{
12
    if (obj_orange_green_controller.powerup == 1)
13
        timermax = 13;
14
    if (obj_orange_green_controller.powerup == 2)
15
        timermax = 10;
16
    if (obj_orange_green_controller.powerup == 3)
17
        timermax = 6;
18
    if (obj_orange_green_controller.powerup == 4)
19
        timermax = 8;
20
    if (obj_orange_green_controller.powerup >= 5)
21
        timermax = 10;
22
    repeat (location_count)
23
    {
24
        if (obj_orange_green_controller.powerup == 0 && location_i == savelasti)
25
            location_i++;
26
        if (location_i > (location_count - 1))
27
            location_i = 0;
28
    }
29
    savelasti2 = savelasti;
30
    savelasti = location_i;
31
    location_x = landingspot_x[location_i];
32
}
33
timer++;
34
if (timer == (timermax - 3))
35
    image_index = 0;
36
if (timer >= timermax)
37
{
38
    image_index = 1;
39
    timer = 0;
40
    mode2count++;
41
    if ((mode2count % 3) == 0 && obj_orange_green_controller.powerup != 5)
42
    {
43
        if (i_ex(obj_heart))
44
        {
45
            candy = instance_create(x - 48, (y + 46) - 10, obj_regularbullet);
46
            candy.sprite_index = spr_bullet_green_flame;
47
            candy.image_speed = 0.25;
48
            candy.depth = depth - 100;
49
            candy.image_xscale = 2;
50
            candy.image_yscale = 2;
51
            candy.gravity = 0.35;
52
            candy.target = 4;
53
            candy.damage = 96;
54
            with (candy)
55
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("x", x, location_x, 15, 2, "out");
56
            with (candy)
57
                
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("y", y, cameray() + 30 + random_range(-10, 10), 10, 2, "out");
58
            if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 1 && mode == 2)
59
                candy.gravity = choose(0.35, 0.45, 0.25);
60
            if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 3)
61
                candy.gravity = 0.35;
62
        }
63
        if (obj_orange_green_controller.powerup == 2)
64
            mode2count -= irandom(1);
65
    }
66
    else
67
    {
68
        if (obj_orange_green_controller.powerup == 1)
69
        {
70
            sharewithorange_counter++;
71
            if (sharewithorange_counter == 1)
72
                foodtype = 1;
73
            if (sharewithorange_counter >= 2)
74
            {
75
                foodtype = 0;
76
                sharewithorange_counter = 0;
77
            }
78
        }
79
        if (obj_orange_green_controller.powerup == 2)
80
            foodtype = 2;
81
        if (obj_orange_green_controller.powerup == 3)
82
            foodtype = 0;
83
        if (obj_orange_green_controller.powerup == 4)
84
            foodtype = 2;
85
        if (obj_orange_green_controller.powerup >= 5)
86
        {
87
            sharewithorange_counter++;
88
            if (sharewithorange_counter == 1)
89
                foodtype = 1;
90
            if (sharewithorange_counter == 2)
91
            {
92
                foodtype = 0;
93
                sharewithorange_counter = 0;
94
            }
95
        }
96
        if (i_ex(obj_heart))
97
        {
98
            if (foodtype == 0)
99
            {
100
                candy = instance_create(x - 48, (y + 46) - 10, obj_bullet_healing);
101
                candy.sprite_index = spr_bullet_green_egg;
102
                candy.image_speed = 0.25;
103
                candy.image_blend = hexcolor(c_lime);
104
                candy.depth = depth - 100;
105
                candy.gravity = 0.35;
106
                with (candy)
107
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("x", x, location_x + 18, 15, 2, "out");
108
                with (candy)
109
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("y", y, cameray() + 30 + random_range(-10, 10), 10, 2, "out");
110
                if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 1 && mode == 1)
111
                    candy.gravity = choose(0.35, 0.35, 0.1);
112
                if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 3)
113
                    candy.gravity = 0.35;
114
                candy.con = location_i;
115
            }
116
            if (foodtype == 1)
117
            {
118
                candy = instance_create(x - 48, (y + 46) - 10, obj_bullet_healing);
119
                candy.sprite_index = spr_donut_bullet;
120
                candy.image_blend = hexcolor(c_lime);
121
                candy.depth = depth - 100;
122
                candy.image_xscale = 1;
123
                candy.image_yscale = 1;
124
                candy.vspeed = -14 - random(6);
125
            }
126
            if (foodtype == 2)
127
            {
128
                candy = instance_create(x - 48, (y + 46) - 10, obj_bullet_healing);
129
                candy.sprite_index = spr_swatchling_platter_candy;
130
                candy.image_blend = hexcolor(c_lime);
131
                candy.depth = depth - 100;
132
                candy.image_xscale = 1;
133
                candy.image_yscale = 1;
134
                if (con == 0)
135
                {
136
                    location_x = ((obj_growtangle.x + 12) - (obj_growtangle.sprite_width * 0.5)) + irandom(25);
137
                    con = 1;
138
                }
139
                else
140
                {
141
                    location_x = (obj_growtangle.x + (obj_growtangle.sprite_width * 0.5)) - 10 - irandom(25);
142
                    con = 0;
143
                }
144
                with (candy)
145
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("x", x, location_x, 10, 2, "out");
146
                with (candy)
147
                    
scr_lerpvar
scr_lerpvar

function
scr_lerpvar()
{ var _id = self; if (!is_struct(self)) _id = id; if (argument_count < 6) ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3]);
else ___lerpvar =
scr_lerpvar_instance(_id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]);
return ___lerpvar; } function scr_lerpcol() { if (argument_count < 6) ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3]); else ___lerpvar = scr_lerpcol_instance(id, argument[0], argument[1], argument[2], argument[3], argument[4], argument[5]); return ___lerpvar; }
("y", y, cameray() + 40, 10, 2, "out");
148
                timer = -2;
149
            }
150
            if (foodtype == 0)
151
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ var _doom = instance_create_depth(0, 0, 0, obj_doom); with (_doom) { alarm[0] = arg1; target = arg0; } return _doom; }
(candy, 80);
152
        }
153
    }
154
}
155
draw_self();
156
if (timer >= lifetime || global.turntimer < 1)
157
    instance_destroy();