Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_susiezilla_singlescreen_hazard_Step_0

(view raw script w/o annotations or w/e)
1
if (force_depth == -999999)
2
    depth = 10000 - (y + 45);
3
else
4
    depth = force_depth;
5
with (obj_susiezilla_gamecontroller)
6
{
7
    var sourcedude = other.id;
8
    if (gameover)
9
    {
10
        other.image_speed = 0;
11
        with (obj_lerpvar)
12
        {
13
            if (target == sourcedude)
14
                instance_destroy();
15
        }
16
        exit;
17
    }
18
}
19
if (change_sides)
20
{
21
    if (i_ex(obj_susiezilla_player))
22
    {
23
        if (obj_susiezilla_player.myxcenter < x)
24
            facing = 0;
25
        else
26
            facing = 1;
27
    }
28
}
29
if (y <= 140)
30
{
31
    y = 140;
32
    vspeed = -vspeed;
33
}
34
var lx = 0;
35
var rx = 1280;
36
with (obj_susiezilla_gamecontroller)
37
{
38
    lx = xorig;
39
    rx = xorig + width;
40
}
41
if (x < (lx - 64) || x > (rx + 64))
42
    instance_destroy();
43
if (friendly)
44
    exit;
45
with (obj_susiezilla_gamecontroller)
46
{
47
    if (gameover)
48
        exit;
49
}
50
myxcenter = x;
51
myycenter = y;
52
if (object_index != obj_susiezilla_laser_segment)
53
    mask_index = spr_tennis_ball_bullet_extra_mask;
54
var _hit = instance_place(x, y, obj_susiezilla_player);
55
if (i_ex(_hit))
56
{
57
    var hitx = mean(x, _hit.x + 32);
58
    var hity = mean(y, _hit.y + 40);
59
    var hitdir = point_direction(x, y, _hit.x + 32, _hit.y + 40);
60
    if (_hit.canmove)
61
    {
62
        if ((_hit.hitactive && !unstoppable) || (_hit.dashcon == 3 && _hit.dashtimer < 5 && !unstoppable))
63
        {
64
            friendly = true;
65
            snd_stop(snd_rudebuster_hit);
66
            snd_play_x(snd_rudebuster_hit, 0.5, 1);
67
            speed = 16;
68
            with (instance_create_depth(x, y, depth - 100, obj_susiezilla_parry_effect))
69
                image_angle = hitdir + 90;
70
            direction = point_direction(_hit.oldxcenter, _hit.oldycenter, xprevious, yprevious);
71
        }
72
        else if (!_hit.invuln)
73
        {
74
            mask_index = -1;
75
            if (instance_place(x, y, obj_susiezilla_player))
76
            {
77
                snd_stop(snd_punchmed);
78
                snd_play_pitch(snd_punchmed, 0.75);
79
                
scr_susiezilla_hiteffect
scr_susiezilla_hiteffect

function
scr_susiezilla_hiteffect(arg0)
{ var _hit = arg0; var _hitmarker =
scr_dark_marker(round((_hit.myxcenter + myxcenter) / 2), round((_hit.myycenter + myycenter) / 2), spr_dogcar_hit);
scr_doom(_hitmarker, 4);
var hitscale = myhitscale; if (_hit.myhitscale > hitscale) hitscale = _hit.myhitscale;
scr_scale(hitscale, _hitmarker);
scr_lerpvar_instance(_hitmarker, "image_xscale", hitscale, 1, 4);
scr_lerpvar_instance(_hitmarker, "image_yscale", hitscale, 1, 4);
_hitmarker.depth = depth - 100; return _hitmarker; }
(_hit);
80
                if (unstoppable)
81
                {
82
                    _hit.take_hit_unblockable(facing, damage, knockback);
83
                }
84
                else
85
                {
86
                    _hit.take_hit(sign(_hit.oldxcenter - x), damage, knockback);
87
                    if (destroy_onhit && !friendly)
88
                    {
89
                        bounce_off_dir = -sign(_hit.oldxcenter - x);
90
                        bounce_off();
91
                        instance_destroy();
92
                    }
93
                }
94
            }
95
        }
96
    }
97
}
98
mask_index = -1;