Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_homealone_present_fallen_ball_Step_0

(view raw script w/o annotations or w/e)
1
if (!can_push)
2
    exit;
3
if (!pushed && x >= 210)
4
{
5
    fallen = true;
6
    pushed = true;
7
}
8
if (pushed)
9
{
10
    push_timer++;
11
    if (!has_hit)
12
    {
13
        if (place_meeting(x, y, obj_homealone_dess_snowflake))
14
        {
15
            has_hit = true;
16
            with (obj_homealone_dess_closet_controller)
17
                hit_snowflake = true;
18
        }
19
    }
20
    if (push_timer == 1)
21
    {
22
        gravity = 0.8;
23
        hspeed = 0.5;
24
        friction = 0.1;
25
        target_y = 108;
26
    }
27
    if (push_timer == 13)
28
    {
29
        hspeed = -hspeed;
30
        vspeed = -vspeed / 2;
31
    }
32
    if (push_timer == 16)
33
        vspeed = -vspeed / 2;
34
    if (y >= target_y)
35
    {
36
        hspeed = 
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); } }
(hspeed, 0, 0.1);
37
        vspeed = 0;
38
        gravity = 0;
39
        if (hspeed == 0)
40
        {
41
            can_push = false;
42
            var fallen_ball = instance_create(x, y, obj_homealone_present_fallen_ball_floor);
43
            fallen_ball.depth = 39900;
44
            with (obj_homealone_present_fallen)
45
            {
46
                ball = -4;
47
                interact_event = true;
48
            }
49
            instance_destroy();
50
            exit;
51
        }
52
    }
53
}