Deltarune (Chapter 5) script viewer

← back to main script listing

gml_Object_obj_ch5_DW29_power_up_Create_0

(view raw script w/o annotations or w/e)
1
_parent = -4;
2
_index = 0;
3
_increment = 0.4487989505128276;
4
_radius = 186;
5
_enemy_list = [];
6
_active = false;
7
8
create_enemy = function(arg0, arg1, arg2, arg3, arg4)
9
{
10
    var new_enemy = instance_create(arg1.x, arg1.y, obj_ch5_DW29_power_up_enemy);
11
    new_enemy.init(id, arg0, arg1, arg2, arg3, arg4);
12
    return new_enemy;
13
};
14
15
start = function(arg0)
16
{
17
    _parent = arg0;
18
    var sprite_list = [8442, 8039, 1830, 4675, 3435, 5659, 8324, 6329];
19
    var bullet_list = [4965, 5241, 6419, 5241, 7307, 2250, 95, 7740];
20
    var a = 2 * pi;
21
    while (a >= 0)
22
    {
23
        var xx = 1634 + (cos(a) * (_radius + 80));
24
        var yy = 460 + (sin(a) * _radius);
25
        var angle = point_direction(xx, yy, view_wport[0] / 2, yy);
26
        var modifier = ((_index % 2) == 0) ? -1 : 1;
27
        _enemy_list[_index] = create_enemy(sprite_list[_index], new Vector2(xx, yy), bullet_list[_index], angle, modifier);
28
        _index++;
29
        if (_index > (array_length(sprite_list) - 1))
30
            break;
31
        a -= _increment;
32
    }
33
    var fade_index = 0;
34
    var i = array_length(_enemy_list) - 1;
35
    while (i >= 0)
36
    {
37
        _enemy_list[i].set_index(fade_index);
38
        _enemy_list[i].fade_in(fade_index * 6);
39
        fade_index++;
40
        i--;
41
    }
42
    _active = true;
43
};
44
45
start_bullets = function()
46
{
47
    var i = array_length(_enemy_list) - 1;
48
    while (i >= 0)
49
    {
50
        _enemy_list[i].start_bullets();
51
        i--;
52
    }
53
};
54
55
is_active = function()
56
{
57
    return _active;
58
};
59
60
stop = function()
61
{
62
    var i = array_length(_enemy_list) - 1;
63
    while (i >= 0)
64
    {
65
        _enemy_list[i].stop();
66
        i--;
67
    }
68
};
69
70
end_sequence = function()
71
{
72
    var i = array_length(_enemy_list) - 1;
73
    while (i >= 0)
74
    {
75
        _enemy_list[i].end_sequence();
76
        i--;
77
    }
78
};
79
80
trigger_event = function(arg0)
81
{
82
    if (arg0 != "enemy_finished")
83
        exit;
84
    with (_parent)
85
        trigger_event("power_up_finished");
86
};
87
88
clean_up = function()
89
{
90
    var i = array_length(_enemy_list) - 1;
91
    while (i >= 0)
92
    {
93
        _enemy_list[i].clean_up();
94
        i--;
95
    }
96
    instance_destroy();
97
};