Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_shadowgunner_Step_0

(view raw script w/o annotations or w/e)
1
if (kris == 0)
2
{
3
    with (obj_mainchara_board)
4
    {
5
        if (controlled == 1)
6
            other.kris = id;
7
    }
8
}
9
if (type == 0)
10
{
11
    if (obj_board_camera.con == 0)
12
    {
13
        timer++;
14
        if (bunny && timer < startWait)
15
        {
16
            if (i_ex(obj_board_playercamera))
17
                timer--;
18
        }
19
        if (timer == startWait)
20
        {
21
            image_alpha = 1;
22
            snd_stop(snd_board_splash);
23
            snd_play_pitch(snd_board_splash, 1.2);
24
            var leaves = instance_create(x, y, obj_board_afterimage);
25
            leaves.depth = depth - 1;
26
            with (leaves)
27
            {
28
                image_speed = 0.25;
29
                sprite_index = spr_board_shadowgunner_leaves;
30
                length = 8;
31
                gravity = 0.5;
32
                
scr_darksize
scr_darksize

function
scr_darksize()
{ var inst = id; if (argument_count) inst = argument0; inst.image_xscale = 2; inst.image_yscale = 2; }
();
33
                image_xscale = other.image_xscale;
34
            }
35
        }
36
        if (bunny)
37
        {
38
            if (timer == (startWait + buntimer))
39
                instance_destroy();
40
        }
41
        if ((timer == (startWait + ((shootWait + shootRate) * 1)) || timer == (startWait + ((shootWait + shootRate) * 2)) || timer == (startWait + ((shootWait + shootRate) * 3))) && !bunny)
42
        {
43
            var bulx = x + 32;
44
            if (facing == 1)
45
                bulx -= 32;
46
            var buly = y + 22;
47
            var controlledplayer = 0;
48
            with (obj_mainchara_board)
49
            {
50
                if (controlled == 1)
51
                    controlledplayer = id;
52
            }
53
            var bul = instance_create(bulx, buly, obj_board_enemy_bullet);
54
            var dir = point_direction(bulx, buly, controlledplayer.x + 16, controlledplayer.y + 16);
55
            bul.direction = dir;
56
            bul.speed = 6;
57
            snd_stop(snd_noise);
58
            snd_play_pitch(snd_noise, 0.8);
59
        }
60
        if (timer == (startWait + ((shootWait + shootRate) * 3) + (shootWait * 2)))
61
            instance_destroy();
62
    }
63
    else if (image_alpha == 1 || i_ex(hat))
64
    {
65
        instance_destroy();
66
    }
67
    if (points == 1)
68
    {
69
        points = 0;
70
        var pointsval = 10;
71
        if (bunny)
72
            pointsval = 25;
73
        var pointsDisplay = instance_create(x + 16, y, obj_board_pointsGetDisplay);
74
        pointsDisplay.amount = pointsval;
75
        pointsDisplay.depth = depth - 1;
76
    }
77
    if (x < kris.x)
78
        facing = 0;
79
    else
80
        facing = 1;
81
}
82
if (type == 2)
83
{
84
    timer++;
85
    if (timer == 1)
86
        image_alpha = 1;
87
    if (timer == 10)
88
    {
89
        var bulx = x + 32;
90
        if (facing == 1)
91
            bulx -= 32;
92
        var buly = y + 22;
93
        var controlledplayer = 0;
94
        with (obj_mainchara_board)
95
        {
96
            if (controlled == 1)
97
                controlledplayer = id;
98
        }
99
        var randrage = irandom_range(-5, 5);
100
        for (var i = 0; i < 4; i++)
101
        {
102
            var bul = instance_create(bulx, buly, obj_board_enemy_bullet);
103
            bul.direction = ((-32 + (i * 16)) - 90) + 45 + (270 * facing) + randrage;
104
            bul.speed = 6;
105
        }
106
        snd_stop(snd_noise);
107
        snd_play_pitch(snd_noise, 0.8);
108
    }
109
    if (timer == 30)
110
        instance_destroy();
111
}
112
if (i_ex(obj_board_deathevent))
113
    instance_destroy();
114
if (obj_board_camera.shift != "none")
115
{
116
    safe_delete(hat);
117
    instance_destroy();
118
}