Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_attack_green_cookingtime_Draw_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
        candy = instance_create(x - 48, (y + 46) - 10, obj_regularbullet);
44
        candy.sprite_index = spr_bullet_green_flame;
45
        candy.image_speed = 0.25;
46
        candy.depth = depth - 100;
47
        candy.image_xscale = 2;
48
        candy.image_yscale = 2;
49
        candy.gravity = 0.35;
50
        candy.target = 4;
51
        candy.damage = 96;
52
        with (candy)
53
            
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");
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; }
("y", y, cameray() + 30 + random_range(-10, 10), 10, 2, "out");
56
        if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 1 && mode == 2)
57
            candy.gravity = choose(0.35, 0.45, 0.25);
58
        if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 3)
59
            candy.gravity = 0.35;
60
        if (obj_orange_green_controller.powerup == 2)
61
            mode2count -= irandom(1);
62
    }
63
    else
64
    {
65
        if (obj_orange_green_controller.powerup == 1)
66
        {
67
            sharewithorange_counter++;
68
            if (sharewithorange_counter == 1)
69
                foodtype = 1;
70
            if (sharewithorange_counter >= 2)
71
            {
72
                foodtype = 0;
73
                sharewithorange_counter = 0;
74
            }
75
        }
76
        if (obj_orange_green_controller.powerup == 2)
77
            foodtype = 2;
78
        if (obj_orange_green_controller.powerup == 3)
79
            foodtype = 0;
80
        if (obj_orange_green_controller.powerup == 4)
81
            foodtype = 2;
82
        if (obj_orange_green_controller.powerup >= 5)
83
        {
84
            sharewithorange_counter++;
85
            if (sharewithorange_counter == 1)
86
                foodtype = 1;
87
            if (sharewithorange_counter == 2)
88
            {
89
                foodtype = 0;
90
                sharewithorange_counter = 0;
91
            }
92
        }
93
        if (foodtype == 0)
94
        {
95
            candy = instance_create(x - 48, (y + 46) - 10, obj_bullet_healing);
96
            candy.sprite_index = spr_bullet_green_egg;
97
            candy.image_speed = 0.25;
98
            candy.image_blend = hexcolor(c_lime);
99
            candy.depth = depth - 100;
100
            candy.gravity = 0.35;
101
            with (candy)
102
                
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");
103
            with (candy)
104
                
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");
105
            if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 1 && mode == 1)
106
                candy.gravity = choose(0.35, 0.35, 0.1);
107
            if (i_ex(obj_orange_green_controller) && obj_orange_green_controller.powerup >= 3)
108
                candy.gravity = 0.35;
109
            candy.con = location_i;
110
        }
111
        if (foodtype == 1)
112
        {
113
            candy = instance_create(x - 48, (y + 46) - 10, obj_bullet_healing);
114
            candy.sprite_index = spr_donut_bullet;
115
            candy.image_blend = hexcolor(c_lime);
116
            candy.depth = depth - 100;
117
            candy.image_xscale = 1;
118
            candy.image_yscale = 1;
119
            candy.vspeed = -14 - random(6);
120
        }
121
        if (foodtype == 2)
122
        {
123
            candy = instance_create(x - 48, (y + 46) - 10, obj_bullet_healing);
124
            candy.sprite_index = spr_swatchling_platter_candy;
125
            candy.image_blend = hexcolor(c_lime);
126
            candy.depth = depth - 100;
127
            candy.image_xscale = 1;
128
            candy.image_yscale = 1;
129
            if (con == 0)
130
            {
131
                location_x = ((obj_growtangle.x + 12) - (obj_growtangle.sprite_width * 0.5)) + irandom(25);
132
                con = 1;
133
            }
134
            else
135
            {
136
                location_x = (obj_growtangle.x + (obj_growtangle.sprite_width * 0.5)) - 10 - irandom(25);
137
                con = 0;
138
            }
139
            with (candy)
140
                
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");
141
            with (candy)
142
                
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");
143
            timer = -2;
144
        }
145
    }
146
    if (foodtype == 0)
147
        
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ var _doom = instance_create_depth(0, 0, 0, obj_doom); with (_doom) { alarm[0] target = arg0; } return _doom; }
(candy, 80);
148
}
149
draw_self();
150
if (timer >= lifetime || global.turntimer < 1)
151
    instance_destroy();