Deltarune (Chapter 2) script viewer

← back to main script listing

gml_Object_obj_queen_lasergun_Step_0

(view raw script w/o annotations or w/e)
1
if (!instance_exists(obj_queen_bulletcontroller))
2
{
3
    instance_destroy();
4
    exit;
5
}
6
if (init == 0)
7
{
8
    if (instance_exists(obj_heart))
9
    {
10
        idealangle = point_direction(x, y, obj_heart.x + 10, obj_heart.y + 10);
11
        aimx = obj_heart.x;
12
        aimy = obj_heart.y;
13
    }
14
    else
15
    {
16
        idealangle = 270;
17
    }
18
    if (randomshot)
19
    {
20
        if (floor(random(3)))
21
            idealangle += random_range(-20, 20);
22
    }
23
    currentangle = idealangle + 360;
24
    init = 1;
25
    snd_play(snd_spearappear);
26
    timer = 0;
27
    size = 0;
28
}
29
inittimer++;
30
if (inittimer >= inittime)
31
{
32
    if (con == 0)
33
    {
34
        timer++;
35
        size = lerp(0, maxsize, timer / aimtime);
36
        currentangle = lerp(currentangle, idealangle, timer / aimtime);
37
        if (timer >= aimtime)
38
        {
39
            con = 1;
40
            timer = 0;
41
        }
42
    }
43
    image_angle = currentangle;
44
    image_xscale = size;
45
    image_yscale = size;
46
    if (con == 1)
47
    {
48
        timer++;
49
        if (timer >= waittime)
50
        {
51
            snd_play(snd_wallclaw);
52
            laser = instance_create(x, y, obj_queen_laser);
53
            laser.image_angle = image_angle;
54
            laser.direction = image_angle;
55
            laser.image_yscale = shotsize;
56
            con = 2;
57
            timer = 0;
58
        }
59
    }
60
    if (con == 2)
61
    {
62
        direction = image_angle;
63
        speed -= 0.25;
64
        timer++;
65
        if (timer >= 10)
66
            image_alpha -= 0.1;
67
        if (image_alpha <= 0)
68
            instance_destroy();
69
    }
70
}