Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_bullet_healing_Step_0

(view raw script w/o annotations or w/e)
1
if (wall_destroy == 1)
2
{
3
    if (x < (camerax() - 80) || x > (camerax() + 640 + 80) || y < (cameray() - 80) || y > (cameray() + 480 + 80))
4
        instance_destroy();
5
}
6
if (updateimageangle == 1)
7
    image_angle = direction;
8
if (spin == 1)
9
    image_angle += spinspeed;
10
if (bottomfade != 0)
11
{
12
    if (y > (cameray() + bottomfade))
13
        image_alpha *= 0.8;
14
}
15
lifetime++;
16
if (lifetime >= maxlifetime || !i_ex(obj_heart))
17
    instance_destroy();
18
if (i_ex(obj_orange_green_controller) && i_ex(obj_heart) && obj_orange_green_controller.treasurehunter && distance_to_object(obj_heart) < 30)
19
{
20
    var _direction = point_direction(x, y, obj_heart.x + 10, obj_heart.y + 10);
21
    x += lengthdir_x(6, _direction);
22
    y += lengthdir_y(6, _direction);
23
}
24
if (sprite_index == spr_donut_bullet)
25
{
26
    if (con == 0)
27
        x -= donut_speed;
28
    if (con == 1)
29
        x += donut_speed;
30
    if (x < (obj_growtangle.x - (obj_growtangle.sprite_width * 0.25)) && vspeed > 0)
31
    {
32
        x = obj_growtangle.x - (obj_growtangle.sprite_width * 0.25);
33
        con = 1;
34
        snd_stop(snd_petaldrain);
35
        snd_play(snd_petaldrain);
36
    }
37
    if (x > (obj_growtangle.x + (obj_growtangle.sprite_width * 0.45)) && y > (obj_growtangle.y - (obj_growtangle.sprite_height * 0.5)) && vspeed > 0)
38
    {
39
        x = obj_growtangle.x + (obj_growtangle.sprite_width * 0.45) + 4;
40
        con = 0;
41
        snd_stop(snd_petaldrain);
42
        snd_play(snd_petaldrain);
43
    }
44
    vspeed += donut_gravity;
45
    if (vspeed > 8)
46
        speed = 8;
47
}
48
var _repeat = 1;
49
var _afterimage_timer = 0;
50
if (sprite_index == spr_swatchling_platter_candy)
51
{
52
    _repeat = 40;
53
    timer++;
54
    if (timer == 1)
55
        speed = 0;
56
    if (timer >= 5)
57
        image_angle = lerp(image_angle, 90, 0.4);
58
    if (timer == 10)
59
        snd_play(snd_bell_bounce_short);
60
    if (timer >= 10 && timer <= 15)
61
        telegraph_alpha += 0.2;
62
    if (timer >= 15 && timer <= 20)
63
        telegraph_alpha -= 0.2;
64
    if (timer == 25)
65
        snd_play(snd_bomb, 1, 1.3);
66
    if (timer == 80)
67
        instance_destroy();
68
}
69
if (timer >= 25 || sprite_index != spr_swatchling_platter_candy)
70
{
71
    repeat (_repeat)
72
    {
73
        if (sprite_index == spr_swatchling_platter_candy)
74
            y += 1;
75
        if (_afterimage_timer == 10 || _afterimage_timer == 20 || _afterimage_timer == 30)
76
            
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
77
        if (place_meeting(x, y, obj_heart) && image_alpha > 0)
78
        {
79
            if (sprite_index == spr_swatchling_platter_candy)
80
            {
81
                y -= 40;
82
                
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; if (global.chapter == 5 && i_ex(obj_tensionbar) && global.tension > obj_tensionbar.maxtensionlimit) global.tension = obj_tensionbar.maxtensionlimit; }
(7);
83
            }
84
            if (sprite_index == spr_donut_bullet)
85
            {
86
                y -= 40;
87
                
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; if (global.chapter == 5 && i_ex(obj_tensionbar) && global.tension > obj_tensionbar.maxtensionlimit) global.tension = obj_tensionbar.maxtensionlimit; }
(4);
88
            }
89
            snd_play(snd_power);
90
            var _hp_1 = 0;
91
            var _hp_2 = 0;
92
            var _hp_3 = 0;
93
            if (global.hp[1] <= 0)
94
            {
95
                global.hp[1] = 0;
96
                _hp_1 = 1;
97
            }
98
            if (global.hp[2] <= 0)
99
            {
100
                global.hp[2] = 0;
101
                _hp_2 = 1;
102
            }
103
            if (global.hp[3] <= 0)
104
            {
105
                global.hp[3] = 0;
106
                _hp_3 = 1;
107
            }
108
            
scr_healall
scr_healall

function
scr_healall(arg0)
{ for (i = 0; i < 3; i += 1) { if (global.char[i] != 0)
scr_heal(i, arg0);
} }
(1);
109
            if (_hp_1 == 1)
110
                global.hp[1] = 1;
111
            if (_hp_2 == 1)
112
                global.hp[2] = 1;
113
            if (_hp_3 == 1)
114
                global.hp[3] = 1;
115
            with (obj_heroparent)
116
            {
117
                
scr_tensionheal
scr_tensionheal

function
scr_tensionheal(arg0)
{ global.tension += arg0; if (global.tension > global.maxtension) global.tension = global.maxtension; if (global.chapter == 5 && i_ex(obj_tensionbar) && global.tension > obj_tensionbar.maxtensionlimit) global.tension = obj_tensionbar.maxtensionlimit; }
(4);
118
                ha = instance_create(x, y, obj_healanim);
119
                ha.target = id;
120
                var _alreadyexists = false;
121
                for (var i = 0; i < instance_number(obj_dmgwriter); i++)
122
                {
123
                    dmgwriter[i] = instance_find(obj_dmgwriter, i);
124
                    if (dmgwriter[i].creatorid == id)
125
                    {
126
                        dmgwriter[i].damage += 1;
127
                        dmgwriter[i].init = 0;
128
                        dmgwriter[i].killtimer = -40;
129
                        if (global.hp[global.char[myself]] >= global.maxhp[global.char[myself]])
130
                            dmgwriter[i].specialmessage = 3;
131
                        _alreadyexists = true;
132
                    }
133
                }
134
                if (_alreadyexists == false)
135
                {
136
                    dmgwr = instance_create(x, ((y - 40) + myheight) - 24, obj_dmgwriter);
137
                    healstackwriter = dmgwr;
138
                    with (dmgwr)
139
                    {
140
                        delay = 8;
141
                        type = 3;
142
                        damage = 1;
143
                        typeb = 1;
144
                        creatorid = other.id;
145
                    }
146
                    if (global.hp[global.char[myself]] >= global.maxhp[global.char[myself]])
147
                        dmgwr.specialmessage = 3;
148
                    tu += 1;
149
                }
150
            }
151
            if (sprite_index == spr_swatchling_platter_candy)
152
            {
153
                inst = instance_create(x, y + 40, obj_marker);
154
                inst.sprite_index = spr_swatchling_platter_candy;
155
                inst.image_angle = image_angle;
156
                inst.image_xscale = image_xscale;
157
                inst.image_yscale = image_yscale;
158
                with (inst)
159
                    
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; }
(self, 1);
160
            }
161
            instance_destroy();
162
            break;
163
        }
164
    }
165
}
166
if (place_meeting(x, y, obj_regularbullet) && i_ex(obj_attack_green_cookingtime) && sprite_index == spr_bullet_green_egg)
167
{
168
    var _inst = instance_place(x, y, obj_regularbullet);
169
    if (con == 0)
170
        x += 6;
171
    if (con == 1)
172
    {
173
        if (_inst.x < x)
174
            x += 6;
175
        if (_inst.x > x)
176
            x -= 6;
177
    }
178
    if (con == 2)
179
        x -= 6;
180
}