Deltarune (Chapter 4) script viewer

← back to main script listing

gml_Object_obj_climb_enemy_Step_0

(view raw script w/o annotations or w/e)
1
if (damagecon == 1)
2
{
3
    if (!invincible)
4
    {
5
        damagecon = 2;
6
        active = 0;
7
    }
8
    else
9
    {
10
        damagecon = 0;
11
    }
12
}
13
if (damagecon == 2)
14
{
15
    timer = 0;
16
    image_blend = c_white;
17
    if (i_ex(obj_rotating_tower_controller_new))
18
    {
19
        var flash = 
scr_oflash_tower
scr_oflash_tower

function
scr_oflash_tower()
{ _oflash = instance_create(x, y, obj_oflash_tower); _oflash.image_xscale = image_xscale; _oflash.image_speed = 0; _oflash.image_index = image_index; _oflash.image_yscale = image_yscale; _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
20
        flash.x += flashadjustmentx + 40;
21
        flash.y += flashadjustmenty;
22
    }
23
    else
24
    {
25
        var flash = 
scr_oflash
scr_oflash

function
scr_oflash()
{ _oflash = instance_create(x, y, obj_oflash); _oflash.image_xscale = image_xscale; _oflash.image_speed = 0; _oflash.image_index = image_index; _oflash.image_yscale = image_yscale; _oflash.sprite_index = sprite_index; _oflash.depth = depth - 1; _oflash.target = id; return _oflash; }
();
26
        flash.x += flashadjustmentx;
27
        flash.y += flashadjustmenty;
28
    }
29
    var animation = instance_create(x + 20, y + 20, obj_animation);
30
    animation.sprite_index = spr_attack_cut1;
31
    animation.depth = depth - 10;
32
    animation.image_xscale = 2;
33
    animation.image_yscale = 2;
34
    if (i_ex(obj_rotating_tower_controller_new))
35
    {
36
        animation.x = obj_rotating_tower_controller_new.tower_x;
37
        animation.y = obj_rotating_tower_controller_new.krisy;
38
    }
39
    snd_play_x(snd_swing, 0.4, 1.2);
40
    snd_play_x(snd_laz_c, 0.3, 1.2);
41
    if (i_ex(obj_rotating_tower_controller_new))
42
        
scr_shakeobj_tower
scr_shakeobj_tower

function
scr_shakeobj_tower()
{ var _shakeobj = instance_create(x, y, obj_shakeobj_tower); _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); }
();
43
    else
44
        
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); }
();
45
    hp--;
46
    if (hp > 0)
47
    {
48
        damagecon = 0;
49
        with (obj_climb_kris)
50
        {
51
            fallingcon = 1;
52
            fallingtimer = 20;
53
        }
54
    }
55
    else
56
    {
57
        damagecon = 3;
58
    }
59
}
60
if (damagecon == 3)
61
{
62
    timer++;
63
    if (timer >= 8)
64
    {
65
        var animation = instance_create(x + 20, y + 20, obj_animation);
66
        animation.sprite_index = spr_attack_slap2;
67
        animation.image_blend = c_white;
68
        animation.image_speed = 0.5;
69
        animation.depth = depth - 1;
70
        animation.image_xscale = 2;
71
        animation.image_yscale = 2;
72
        if (i_ex(obj_rotating_tower_controller_new))
73
        {
74
            animation.x = obj_rotating_tower_controller_new.tower_x;
75
            animation.y = obj_rotating_tower_controller_new.krisy;
76
        }
77
        animation = instance_create(x + 20, y + 20, obj_animation);
78
        animation.sprite_index = spr_attack_slap2;
79
        animation.image_blend = c_black;
80
        animation.image_speed = 0.5;
81
        animation.depth = depth - 1;
82
        animation.image_xscale = 3;
83
        animation.image_yscale = 3;
84
        if (i_ex(obj_rotating_tower_controller_new))
85
        {
86
            animation.x = obj_rotating_tower_controller_new.tower_x;
87
            animation.y = obj_rotating_tower_controller_new.krisy;
88
        }
89
        with (animation)
90
            
scr_afterimage
scr_afterimage

function
scr_afterimage()
{ afterimage = instance_create(x, y, obj_afterimage); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; return afterimage; }
();
91
        snd_play_x(snd_swing, 1, 0.5);
92
        snd_play_x(snd_damage, 0.5, 0.5);
93
        snd_play_x(snd_punchmed, 0.4, 1);
94
        if (i_ex(obj_rotating_tower_controller_new))
95
        {
96
            var cut = 
scr_afterimage_cut_half_tower
scr_afterimage_cut_half_tower

function
scr_afterimage_cut_half_tower()
{ afterimage = instance_create(x, y, obj_afterimage_cut_half_tower); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; with (afterimage) event_user(0); return afterimage; }
();
97
            cut.x += effectadjustmentx + 40;
98
            cut.y += effectadjustmenty;
99
        }
100
        else
101
        {
102
            var cut = 
scr_afterimage_cut_half
scr_afterimage_cut_half

function
scr_afterimage_cut_half()
{ afterimage = instance_create(x, y, obj_afterimage_cut_half); afterimage.sprite_index = sprite_index; afterimage.image_index = image_index; afterimage.image_blend = image_blend; afterimage.image_speed = 0; afterimage.depth = depth; afterimage.image_xscale = image_xscale; afterimage.image_yscale = image_yscale; afterimage.image_angle = image_angle; with (afterimage) event_user(0); return afterimage; }
();
103
            cut.x += effectadjustmentx;
104
            cut.y += effectadjustmenty;
105
        }
106
        instance_destroy();
107
    }
108
}