Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_knight_pointing_star_Step_0

(view raw script w/o annotations or w/e)
1
if (x < (camerax() - (sprite_width / 2)) || y < (cameray() - (sprite_height / 2)) || y > (cameray() + 480 + (sprite_height / 2)))
2
{
3
    instance_destroy();
4
    exit;
5
}
6
if (!init)
7
{
8
    if (difficulty == 0)
9
        sprite_index = spr_knight_bullet_star_easy;
10
    init = true;
11
}
12
grazetimer++;
13
if ((grazetimer % 4) == 0)
14
    grazed = 0;
15
if (con == 0)
16
{
17
    image_xscale += growspeed;
18
    image_yscale += growspeed;
19
}
20
else if (con == 1)
21
{
22
    friction = 0.5;
23
    con++;
24
}
25
else if (con == 2)
26
{
27
    mask_index = spr_knight_bullet_star_mask;
28
    if (speed == 0)
29
    {
30
        gravity = 0.1;
31
        gravity_direction = direction - 180;
32
        friction = 0;
33
    }
34
    timer++;
35
    if (timer >= 40)
36
    {
37
        timer = 0;
38
        con++;
39
        if (playSound)
40
            snd_play(snd_explosion_firework);
41
    }
42
    growstart = image_xscale;
43
    if (difficulty == 2)
44
    {
45
    }
46
}
47
else if (con == 3)
48
{
49
    timer++;
50
    image_xscale = growstart + clamp01(timer / 2);
51
    image_yscale = growstart + clamp01(timer / 2);
52
    if (timer == 3)
53
    {
54
        var _angle = 90;
55
        var _count = 6;
56
        if (difficulty == 2)
57
        {
58
            _angle += side;
59
            _count = 2;
60
        }
61
        for (i = 0; i < 6; i++)
62
        {
63
            d = 
scr_childbullet
scr_childbullet

function
scr_childbullet()
{ var __child = instance_create(argument[0], argument[1], argument[2]); var __parent = (argument_count == 4) ? argument[3] : id; if (__parent.damage != -1) __child.damage = __parent.damage; if (__parent.grazepoints != -1) __child.grazepoints = __parent.grazepoints; if (__parent.timepoints != -1) __child.timepoints = __parent.timepoints; if (__parent.inv != -1) __child.inv = __parent.inv; if (__parent.target != -1) __child.target = __parent.target; if (__parent.grazed != -1) __child.grazed = __parent.grazed; if (__parent.grazetimer != -1) __child.grazetimer = __parent.grazetimer; __child.element = __parent.element; return __child; }
(x, y, obj_knight_pointing_starchild);
64
            d.image_angle = _angle;
65
            d.direction = _angle;
66
            if (difficulty == 0 && (i % 2) == 1)
67
            {
68
                d.speed = 1;
69
                d.lifetime = 30;
70
            }
71
            else
72
            {
73
                d.speed = 4;
74
            }
75
            d.image_xscale = image_xscale * 0.5;
76
            d.image_yscale = image_yscale * 0.5;
77
            d.deceleration = 0.15;
78
            if (difficulty == 2 && (i % 3) > 0)
79
            {
80
                d.difficulty = -1;
81
                d.lifetime = 30;
82
                d.speed = 2;
83
                if (i == 1 || i == 4)
84
                {
85
                    d.speed /= 3;
86
                    d.minspeed /= 3;
87
                    d.deceleration /= 3;
88
                }
89
                else
90
                {
91
                    d.speed *= 2/3;
92
                    d.minspeed *= 2/3;
93
                    d.deceleration *= 2/3;
94
                }
95
                d.sprite_index = spr_knight_starchild_trail;
96
            }
97
            else
98
            {
99
                d.difficulty = difficulty;
100
            }
101
            if (i == 1 || i == 4)
102
                _angle += ((difficulty == 2) ? 180 : 48);
103
            else
104
                _angle += ((difficulty == 2) ? 0 : 66);
105
        }
106
        active = false;
107
    }
108
    if (timer >= 4)
109
    {
110
        image_xscale = (sprite_width + 16) / sprite_get_width(sprite_index);
111
        image_yscale = (sprite_height + 16) / sprite_get_height(sprite_index);
112
        var _aimage = 
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; }
();
113
        _aimage.fadeSpeed *= 3;
114
        instance_destroy();
115
    }
116
}