Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_homealone_dess_hockey_puck_Draw_0

(view raw script w/o annotations or w/e)
1
if (!is_thrown && t == 0)
2
    draw_self();
3
if (t == 1)
4
{
5
    create_puck(obj_homealone_heart.x, obj_homealone_heart.y, depth);
6
    base_alpha = 1;
7
}
8
if (t >= 1)
9
{
10
    var base_x = x + 10;
11
    var base_y = y - 10;
12
    xDist = base_x - bounce_xpos;
13
    yDist = base_y - bounce_ypos;
14
    smear_width = 1;
15
    smear_length = abs(sqrt(sqr(xDist) + sqr(yDist)));
16
    smear_angle = degtorad(point_direction(base_x, base_y, bounce_xpos, bounce_ypos));
17
    alph = 0.1 / smear_length;
18
    base_alpha -= 0.25;
19
    for (var i = 0; i < smear_length; i += smear_width)
20
        draw_sprite_ext(spr_noellehouse_dess_hockey_puck_smear, 0, base_x + (cos(smear_angle) * i) + (cos(smear_angle) * (smear_width / 2)), (base_y - (sin(smear_angle) * i)) + (sin(smear_angle) * (smear_width / 2)), 1, 1, 0, c_white, base_alpha * ((t / 8) + (i / smear_length)));
21
    if (t == 2)
22
    {
23
        bounce = true;
24
        snd_play(snd_hurt1);
25
        with (obj_noellehouse_dess)
26
            hit_heart = true;
27
    }
28
    if (base_alpha <= 0)
29
    {
30
        if (loop)
31
        {
32
            t = 0;
33
            g = 0;
34
        }
35
        else
36
        {
37
            throw_choco = false;
38
            t = 0;
39
            g = 0;
40
            is_thrown = true;
41
        }
42
    }
43
}
44
if (bounce)
45
{
46
    bounce_timer++;
47
    if (bounce_timer >= 2)
48
    {
49
        var velocity = bounce_timer * 4;
50
        with (bounce_bottle)
51
        {
52
            var ypos = clamp(obj_homealone_heart.y + 100, y, 130);
53
            if (obj_homealone_heart.image_angle < 0)
54
                hspeed = (y != ypos) ? -2 : 0;
55
            else
56
                hspeed = (y != ypos) ? 2 : 0;
57
            y = 
scr_movetowards
scr_movetowards

function
scr_movetowards(arg0, arg1, arg2)
{ if (arg0 == arg1) return arg0; else if (arg0 > arg1) return max(arg0 - arg2, arg1); else return min(arg0 + arg2, arg1); } function scr_obj_movetowards_obj(arg0, arg1, arg2 = 0, arg3 = 0) { scr_obj_movetowards_point(arg0.x + arg2, arg0.y + arg3, arg1); } function scr_obj_movetowards_point(arg0, arg1, arg2) { var _distance = point_distance(x, y, arg0, arg1); if (arg2 >= _distance) { x = arg0; y = arg1; } else { var _direction = point_direction(x, y, arg0, arg1); x += lengthdir_x(arg2, _direction); y += lengthdir_y(arg2, _direction); } }
(y, ypos, velocity);
58
        }
59
    }
60
}