Deltarune (Chapter 3) script viewer

← back to main script listing

gml_GlobalScript_scr_board_enemy_sword_collision

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

function
scr_board_enemy_sword_collision()
{ var deer_following = false; if (object_index == obj_board_enemy_deer && follow == true) deer_following = true; if (place_meeting(x, y, obj_board_swordhitbox) && hurttimer == 0 && obj_board_controller.kris_object.swordlv >= sword_immunity_lv && deer_following == false) { var hitbox = instance_place(x, y, obj_board_swordhitbox); if (hitbox.detectiononly == true) { with (obj_mainchara_board) { if (swordbuffer <= 0) { swordbuffer = 8; canfreemove = 0; snd_play(choose(snd_board_sword1, snd_board_sword2, snd_board_sword3)); } } } else if ((object_index == obj_board_enemy_monster && image_blend == c_gray) || (object_index == obj_board_enemy_bluebird && room == room_board_dungeon_2)) { snd_stop(snd_board_sword_metal); snd_play(snd_board_sword_metal); hitdir = -1; hurttimer = 10; } else { path_end(); hurttimer = 10; snd_stop(snd_board_damage); snd_play(snd_board_damage); active_hitbox = false; hitdir = obj_board_controller.kris_object.facing; if (hp != 999) hp--; } } if (place_meeting(x, y, obj_board_enemy_deer_ice_spell) && object_index != obj_board_enemy_deer) { snd_stop(snd_board_splash); snd_play(snd_board_splash); if (object_index != obj_board_enemy_bluefish && object_index != obj_board_enemy_yellowflower) { block = instance_create(x, y, obj_pushableblock_board); block.sprite_index = spr_board_pushableblock_ice; block.custom_sprite = spr_board_pushableblock_ice; block.image_xscale = 1; block.image_yscale = 1; var x_cell = floor(block.x / global.cell_size); var y_cell = floor((block.y + 18) / global.cell_size); var position_x = (x_cell * global.cell_size) + (global.cell_size / 2); var position_y = (y_cell * global.cell_size) + (global.cell_size / 2); block.x = position_x - 16; block.y = position_y - 16; var count = 6; for (var i = 0; i < count; i++) { var fx =
scr_board_marker((block.x + 16) - 2, (block.y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
fx.direction = ((360 / count) * i) + 45; fx.speed = 8; fx.friction = 0.6;
scr_doom(fx, 10);
fx =
scr_board_marker((block.x + 16) - 2, (block.y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
fx.direction = (360 / count) * i; fx.speed = 4; fx.friction = 0.3;
scr_doom(fx, 10);
} } else { var count = 6; for (var i = 0; i < count; i++) { var fx =
scr_board_marker((x + 16) - 2, (y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
fx.direction = ((360 / count) * i) + 45; fx.speed = 8; fx.friction = 0.6;
scr_doom(fx, 10);
fx =
scr_board_marker((x + 16) - 2, (y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
fx.direction = (360 / count) * i; fx.speed = 4; fx.friction = 0.3;
scr_doom(fx, 10);
} } instance_destroy(); if (spawnerid != -1 && i_ex(spawnerid)) { if (object_index != obj_board_enemy_yellowflower && object_index != obj_board_enemy_bluefish) spawnerid.image_index = 20; else safe_delete(spawnerid); } } if (place_meeting(x, y, obj_board_swordhitbox) && hurttimer == 0 && obj_board_controller.kris_object.swordlv < sword_immunity_lv && deer_following == false) { snd_stop(snd_board_sword_metal); snd_play(snd_board_sword_metal); ...
()
2
{
3
    var deer_following = false;
4
    if (object_index == obj_board_enemy_deer && follow == true)
5
        deer_following = true;
6
    if (place_meeting(x, y, obj_board_swordhitbox) && hurttimer == 0 && obj_board_controller.kris_object.swordlv >= sword_immunity_lv && deer_following == false)
7
    {
8
        var hitbox = instance_place(x, y, obj_board_swordhitbox);
9
        if (hitbox.detectiononly == true)
10
        {
11
            with (obj_mainchara_board)
12
            {
13
                if (swordbuffer <= 0)
14
                {
15
                    swordbuffer = 8;
16
                    canfreemove = 0;
17
                    snd_play(choose(snd_board_sword1, snd_board_sword2, snd_board_sword3));
18
                }
19
            }
20
        }
21
        else if ((object_index == obj_board_enemy_monster && image_blend == c_gray) || (object_index == obj_board_enemy_bluebird && room == room_board_dungeon_2))
22
        {
23
            snd_stop(snd_board_sword_metal);
24
            snd_play(snd_board_sword_metal);
25
            hitdir = -1;
26
            hurttimer = 10;
27
        }
28
        else
29
        {
30
            path_end();
31
            hurttimer = 10;
32
            snd_stop(snd_board_damage);
33
            snd_play(snd_board_damage);
34
            active_hitbox = false;
35
            hitdir = obj_board_controller.kris_object.facing;
36
            if (hp != 999)
37
                hp--;
38
        }
39
    }
40
    if (place_meeting(x, y, obj_board_enemy_deer_ice_spell) && object_index != obj_board_enemy_deer)
41
    {
42
        snd_stop(snd_board_splash);
43
        snd_play(snd_board_splash);
44
        if (object_index != obj_board_enemy_bluefish && object_index != obj_board_enemy_yellowflower)
45
        {
46
            block = instance_create(x, y, obj_pushableblock_board);
47
            block.sprite_index = spr_board_pushableblock_ice;
48
            block.custom_sprite = spr_board_pushableblock_ice;
49
            block.image_xscale = 1;
50
            block.image_yscale = 1;
51
            var x_cell = floor(block.x / global.cell_size);
52
            var y_cell = floor((block.y + 18) / global.cell_size);
53
            var position_x = (x_cell * global.cell_size) + (global.cell_size / 2);
54
            var position_y = (y_cell * global.cell_size) + (global.cell_size / 2);
55
            block.x = position_x - 16;
56
            block.y = position_y - 16;
57
            var count = 6;
58
            for (var i = 0; i < count; i++)
59
            {
60
                var fx = 
scr_board_marker
scr_board_marker

function
scr_board_marker()
{ var _thismarker = instance_create(argument0, argument1, obj_board_marker); _thismarker.sprite_index = argument2; _thismarker.image_xscale = 2; _thismarker.image_yscale = 2; if (argument_count >= 4) _thismarker.image_speed = argument3; if (argument_count >= 5) { if (argument4 != -1) _thismarker.depth = argument4; } if (argument_count >= 6) _thismarker.image_xscale = argument5; if (argument_count >= 6) _thismarker.image_yscale = argument5; if (argument_count >= 7) _thismarker.animateonce = argument6; return _thismarker; }
((block.x + 16) - 2, (block.y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
61
                fx.direction = ((360 / count) * i) + 45;
62
                fx.speed = 8;
63
                fx.friction = 0.6;
64
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(fx, 10);
65
                fx = 
scr_board_marker
scr_board_marker

function
scr_board_marker()
{ var _thismarker = instance_create(argument0, argument1, obj_board_marker); _thismarker.sprite_index = argument2; _thismarker.image_xscale = 2; _thismarker.image_yscale = 2; if (argument_count >= 4) _thismarker.image_speed = argument3; if (argument_count >= 5) { if (argument4 != -1) _thismarker.depth = argument4; } if (argument_count >= 6) _thismarker.image_xscale = argument5; if (argument_count >= 6) _thismarker.image_yscale = argument5; if (argument_count >= 7) _thismarker.animateonce = argument6; return _thismarker; }
((block.x + 16) - 2, (block.y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
66
                fx.direction = (360 / count) * i;
67
                fx.speed = 4;
68
                fx.friction = 0.3;
69
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(fx, 10);
70
            }
71
        }
72
        else
73
        {
74
            var count = 6;
75
            for (var i = 0; i < count; i++)
76
            {
77
                var fx = 
scr_board_marker
scr_board_marker

function
scr_board_marker()
{ var _thismarker = instance_create(argument0, argument1, obj_board_marker); _thismarker.sprite_index = argument2; _thismarker.image_xscale = 2; _thismarker.image_yscale = 2; if (argument_count >= 4) _thismarker.image_speed = argument3; if (argument_count >= 5) { if (argument4 != -1) _thismarker.depth = argument4; } if (argument_count >= 6) _thismarker.image_xscale = argument5; if (argument_count >= 6) _thismarker.image_yscale = argument5; if (argument_count >= 7) _thismarker.animateonce = argument6; return _thismarker; }
((x + 16) - 2, (y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
78
                fx.direction = ((360 / count) * i) + 45;
79
                fx.speed = 8;
80
                fx.friction = 0.6;
81
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(fx, 10);
82
                fx = 
scr_board_marker
scr_board_marker

function
scr_board_marker()
{ var _thismarker = instance_create(argument0, argument1, obj_board_marker); _thismarker.sprite_index = argument2; _thismarker.image_xscale = 2; _thismarker.image_yscale = 2; if (argument_count >= 4) _thismarker.image_speed = argument3; if (argument_count >= 5) { if (argument4 != -1) _thismarker.depth = argument4; } if (argument_count >= 6) _thismarker.image_xscale = argument5; if (argument_count >= 6) _thismarker.image_yscale = argument5; if (argument_count >= 7) _thismarker.animateonce = argument6; return _thismarker; }
((x + 16) - 2, (y + 16) - 2, spr_board_snowflake, 0.3, 100000, 2);
83
                fx.direction = (360 / count) * i;
84
                fx.speed = 4;
85
                fx.friction = 0.3;
86
                
scr_doom
scr_doom

function
scr_doom(arg0, arg1)
{ with (instance_create_depth(0, 0, 0, obj_doom)) { alarm[0] target = arg0; } }
(fx, 10);
87
            }
88
        }
89
        instance_destroy();
90
        if (spawnerid != -1 && i_ex(spawnerid))
91
        {
92
            if (object_index != obj_board_enemy_yellowflower && object_index != obj_board_enemy_bluefish)
93
                spawnerid.image_index = 20;
94
            else
95
                safe_delete(spawnerid);
96
        }
97
    }
98
    if (place_meeting(x, y, obj_board_swordhitbox) && hurttimer == 0 && obj_board_controller.kris_object.swordlv < sword_immunity_lv && deer_following == false)
99
    {
100
        snd_stop(snd_board_sword_metal);
101
        snd_play(snd_board_sword_metal);
102
        if (object_index == obj_board_enemy_monster)
103
        {
104
            hitdir = -1;
105
            hurttimer = 10;
106
        }
107
        if (object_index == obj_board_enemy_yellowflower || object_index == obj_board_enemy_bluefish || object_index == obj_board_enemy_bluebird_board1)
108
            hurttimer = 10;
109
    }
110
}