Undertale script viewer

← back to main script listing

gml_Object_obj_undynespear_Draw_0

(view raw script w/o annotations or w/e)
1
deg = degtorad(rot);
2
x1 = x + (r * cos(deg));
3
y1 = y - (r * sin(deg));
4
x2 = x;
5
y2 = y;
6
if (image_alpha < 1 && active != 0)
7
    image_alpha += 0.1;
8
draw_sprite_ext(sprite_index, image_index, x, y, 1, 1, rot, c_white, image_alpha);
9
if (instance_exists(obj_undynea_actor))
10
    move = obj_undynea_actor.hspeed;
11
x += (move / 3);
12
if (active == 1)
13
{
14
    if (collision_rectangle(x1, y1, x2, y2, obj_mainchara, 0, 1))
15
        col += 1;
16
    else
17
        col = 0;
18
    if (col == 2)
19
        event_user(2);
20
    rot = direction;
21
}
22
if (active == 4)
23
{
24
    rspeed = speed;
25
    rdir = direction;
26
    rot += ramt;
27
    if (ramt > 0)
28
    {
29
        ramt -= 2;
30
    }
31
    else
32
    {
33
        ramt = 0;
34
        move_towards_point(obj_mainchara.x + 7 + gax, obj_mainchara.y + 15, 0.1);
35
        idealrot = direction;
36
        rot %= 360;
37
        if ((rot - idealrot) > 12)
38
            rot -= 4;
39
        if ((rot - idealrot) > 6)
40
            rot -= 2;
41
        if ((rot - idealrot) > 3)
42
            rot -= 1;
43
        if ((rot - idealrot) < -3)
44
            rot += 1;
45
        if ((rot - idealrot) < -6)
46
            rot += 2;
47
        if ((rot - idealrot) < -12)
48
            rot += 4;
49
    }
50
    speed = rspeed;
51
    direction = rdir;
52
}
53
if (active == 0)
54
{
55
    image_alpha -= 0.05;
56
    if (image_alpha < 0.01)
57
        active = 2;
58
}
59
if (active == 2)
60
    instance_destroy();
61
if (y > room_height || x > room_width)
62
    active = 0;