Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_susiezilla_ball_Step_0

(view raw script w/o annotations or w/e)
1
scr_depth_alt
scr_depth_alt

function
scr_depth_alt()
{ depth = 100000 - ((y * 10) + ((sprite_height - sprite_yoffset) * 10)); }
();
2
if (washit == true)
3
{
4
    var lifetimer = 120;
5
    hittimer++;
6
    if (hittimer > (lifetimer * (1/3)) && hittimer < (lifetimer * (2/3)))
7
    {
8
        if ((hittimer % 4) == 0)
9
            image_index = 1 - image_index;
10
    }
11
    if (hittimer > (lifetimer * (2/3)) && hittimer < (lifetimer * 0.8333333333333334))
12
    {
13
        if ((hittimer % 3) == 0)
14
            image_index = 1 - image_index;
15
    }
16
    if (hittimer > (lifetimer * 0.8333333333333334))
17
    {
18
        if ((hittimer % 2) == 0)
19
            image_index = 1 - image_index;
20
    }
21
    if (hittimer > (lifetimer * 0.9666666666666667))
22
        image_index = 1;
23
    if (hittimer >= lifetimer)
24
    {
25
        snd_play(snd_explosion_mmx3);
26
        var __amt = irandom(3) + 6;
27
        for (var i = 0; i < __amt; i++)
28
        {
29
            dust = scr_dark_marker_playonce(x - (sprite_width / 2), (y - (sprite_height / 2)) + fakeheight, spr_susiezilla_houseexplosion);
30
            dust.direction = (i / __amt) * 360;
31
            dust.speed = 3.5 + random_range(-0.2, 0.2);
32
            dust.friction = 0.25;
33
            dust.image_speed = 0.25 + random_range(-0.1, 0.1);
34
            scr_lerp_instance_var(dust, "image_xscale", 0.5, 2, 5);
35
            scr_lerp_instance_var(dust, "image_yscale", 0.5, 2, 5);
36
            with (dust)
37
                
scr_depth_alt
scr_depth_alt

function
scr_depth_alt()
{ depth = 100000 - ((y * 10) + ((sprite_height - sprite_yoffset) * 10)); }
();
38
        }
39
        instance_destroy();
40
    }
41
}
42
if (canhit == true && !i_ex(myhitbox))
43
{
44
    myhitbox = instance_create(x, y, obj_susiezilla_activehitbox);
45
    myhitbox.sprite_index = spr_susiezilla_ball_hitbox;
46
    myhitbox.image_yscale = 2;
47
    myhitbox.image_xscale = 2;
48
    myhitbox.depth = depth - 20;
49
    myhitbox.image_blend = c_yellow;
50
    myhitbox.image_alpha = 0.2;
51
    myhitbox.daddy = id;
52
    myhitbox.visible = false;
53
}
54
if (i_ex(myhitbox))
55
{
56
    if (canhit == false)
57
        safe_delete(myhitbox);
58
}
59
iframes--;
60
if (hitstop <= 0)
61
{
62
    fakevspeed += fakegravity;
63
    fakeheight += fakevspeed;
64
    if (fakeheight >= 0)
65
    {
66
        if (washit == 0 && canhit == true)
67
        {
68
            snd_play(snd_board_bomb);
69
            washit = true;
70
        }
71
        fakevspeed = 0;
72
        fakeheight = 0;
73
        if (abs(hspeed) > 4)
74
        {
75
            fakevspeed = -abs(speed) / 2;
76
            fakevspeed = clamp(fakevspeed, -2, fakevspeed);
77
        }
78
        if (bounce == 0)
79
        {
80
            bounce++;
81
            iframes = 0;
82
            fakevspeed = -4;
83
        }
84
    }
85
    friction = 0.125;
86
    if (abs(speed) < 4 && fakeheight > -1)
87
        canhit = 0;
88
    if (x <= 40)
89
    {
90
        x = 40;
91
        hspeed = -hspeed / 2;
92
    }
93
    if (x >= 600)
94
    {
95
        x = 600;
96
        hspeed = -hspeed / 2;
97
    }
98
    if (y <= 186)
99
    {
100
        y = 186;
101
        vspeed = -vspeed / 2;
102
    }
103
    if (y >= 340)
104
    {
105
        y = 340;
106
        vspeed = -vspeed / 2;
107
    }
108
    hitdir = direction;
109
    hitspeed = speed;
110
    drawshake--;
111
}
112
hitstop--;
113
if (hitstop == 0)
114
{
115
    canhit = 1;
116
    speed = memspeed * 1.5;
117
    direction = memdir;
118
    fakevspeed = -8;
119
    fakegravity = 0.65;
120
    hitstop = -1;
121
    iframes = 15;
122
    washit = true;
123
}
124
myxcenter = x;
125
myycenter = y + fakeheight;
126
var maxspeed = 64;
127
speed = clamp(speed, -maxspeed, maxspeed);