Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_mizzle_spotlight_eye_Step_0

(view raw script w/o annotations or w/e)
1
if (con == 0)
2
{
3
    hspeed += choose(-0.025, 0.025);
4
    vspeed += choose(-0.025, 0.025);
5
    speed = clamp(speed, -0.125, 0.125);
6
}
7
if (con == 1)
8
{
9
    sprite_index = spr_almond;
10
    timer++;
11
    if (timer == 14 || (timer >= 8 && (timer % 2) == 1 && !irandom(3)))
12
    {
13
        con = 2;
14
        direction = point_direction(x, y, obj_heart.x + 10, obj_heart.y + 10) + 180;
15
        speed = 8;
16
        hspeed *= 2;
17
        vspeed *= 0.5;
18
    }
19
}
20
if (con == 2)
21
{
22
    if (x > (obj_heart.x + 10))
23
        hspeed -= 0.275;
24
    else
25
        hspeed += 0.275;
26
    if (y > (obj_heart.y + 10))
27
        vspeed -= 0.275;
28
    else
29
        vspeed += 0.275;
30
    direction = 
scr_rotatetowards
scr_rotatetowards

function
scr_rotatetowards(arg0, arg1, arg2)
{ var __diff = angle_difference(arg1, arg0); if (abs(__diff) > arg2) return arg0 + (sign(__diff) * arg2); else return arg1; } function scr_angle_lerp(arg0, arg1, arg2) { var __diff = angle_difference(arg1, arg0); return arg0 + lerp(0, __diff, arg2); }
(direction, point_direction(x, y, obj_heart.x + 10, obj_heart.y + 10), 0.75);
31
    with (obj_mizzle_spotlight_eye)
32
    {
33
        if (id != other.id)
34
        {
35
            if (point_distance(other.x, other.y, x, y) < 32)
36
            {
37
                x += lengthdir_x(1, point_direction(other.x, other.y, x, y));
38
                y += lengthdir_y(1, point_direction(other.x, other.y, x, y));
39
            }
40
        }
41
    }
42
    speed = clamp(speed, -7, 7);
43
}
44
grazetimer++;
45
if (grazetimer == 10)
46
{
47
    grazetimer = 0;
48
    grazed = 0;
49
}