Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_shutta_pipehand_Step_0

(view raw script w/o annotations or w/e)
1
if (target_pipe != -1)
2
    x = target_pipe.x;
3
var pipeoutspeed = 6;
4
var waittime = 7;
5
if (type == 1)
6
{
7
    pipeoutspeed = 6;
8
    waittime = 12;
9
}
10
if (type == 2 || type == 3)
11
{
12
    pipeoutspeed = 8;
13
    waittime = 26;
14
}
15
if (type == 5)
16
{
17
    pipeoutspeed = 3;
18
    waittime = 3;
19
}
20
if (type == 6)
21
{
22
    pipeoutspeed = 6;
23
    waittime = 11;
24
}
25
if (con == 0)
26
{
27
    timer++;
28
    if (timer == 15)
29
    {
30
        con = 1;
31
        timer = 0;
32
        visible = true;
33
        if (type == 3 || type == 4 || type == 6)
34
        {
35
            sprite_index = spr_shutta_jump;
36
            image_speed = 0.16666666666666666;
37
            image_xscale = 0.2;
38
            image_yscale = 2;
39
            if (type == 3)
40
                snd_play(snd_knight_jump_quick);
41
            else
42
                snd_play(snd_snd_motor_upper_quick_high);
43
        }
44
    }
45
}
46
if (con == 1)
47
{
48
    timer++;
49
    y = lerp(target_pipe.y, target_pipe.y - 60, timer / pipeoutspeed);
50
    if (type == 3 && timer == 3)
51
        expand = 1;
52
    if (type == 4 && timer == 2)
53
        expand = 1;
54
    if (type == 6 && timer == 2)
55
        expand = 1;
56
    if ((timer / pipeoutspeed) >= 0.6)
57
        goodshot = true;
58
    if (timer == pipeoutspeed)
59
    {
60
        con = 2;
61
        timer = 0;
62
        visible = true;
63
    }
64
}
65
if (con == 2)
66
{
67
    timer++;
68
    if (timer == round(waittime / 2) && sprite_index != spr_shutta_jump)
69
        image_xscale *= -1;
70
    if (timer == waittime)
71
    {
72
        con = 3;
73
        timer = 0;
74
        if (type == 3 || type == 4 || type == 6)
75
            compress = 1;
76
        snd_play(snd_motor_swing_down);
77
    }
78
}
79
if (con == 3)
80
{
81
    timer++;
82
    y = lerp(target_pipe.y - 60, target_pipe.y, timer / pipeoutspeed);
83
    if (type == 3 || type == 4 || type == 6)
84
        image_yscale = lerp(2, 1, timer / pipeoutspeed);
85
    if ((timer / pipeoutspeed) >= 0.8)
86
        goodshot = false;
87
    if (timer == pipeoutspeed)
88
    {
89
        instance_destroy();
90
        if (type == 3 || type == 4 || type == 6)
91
        {
92
            with (instance_nearest(x, y, obj_shutta_pipe))
93
            {
94
                
scr_shakeobj
scr_shakeobj

function
scr_shakeobj()
{ var _shakeobj = instance_create(x, y, obj_shakeobj); _shakeobj.target = id; if (argument_count >= 1) { if (i_ex(argument0)) _shakeobj.target = argument0; } if (argument_count >= 2) { if (argument1 != -1) _shakeobj.shakeamt = argument1; } if (argument_count >= 3) { if (argument2 != -1) _shakeobj.shakereduct = argument2; } with (_shakeobj) event_user(0); }
();
95
                snd_play(snd_bump);
96
            }
97
        }
98
    }
99
}
100
if (expand == 1)
101
{
102
    expandtimer++;
103
    var duration = 8;
104
    var targetxscale = lerp(8, 2, expandtimer / duration);
105
    image_xscale = lerp(0, targetxscale, 
scr_ease_in
scr_ease_in

function
scr_ease_in(arg0, arg1)
{ if (arg1 < -3 || arg1 > 7) return arg0; switch (arg1) { case -3: return ease_in_bounce(arg0, 0, 1, 1); case -2: return ease_in_elastic(arg0, 0, 1, 1); case -1: var _s = 1.70158; return arg0 * arg0 * (((_s + 1) * arg0) - _s); case 0: return arg0; case 1: return -cos(arg0 * 1.5707963267948966) + 1; case 6: return power(2, 10 * (arg0 - 1)); case 7: return -(sqrt(1 - sqr(arg0)) - 1); default: return power(arg0, arg1); } }
(expandtimer / duration, 1));
106
    if (expandtimer == duration)
107
        expand = 0;
108
}
109
if (compress == 1)
110
{
111
    compresstimer++;
112
    image_xscale = lerp(2, 0.4, compresstimer / 5);
113
    if (compresstimer == 5)
114
        compress = 0;
115
}