Deltarune (Chapter 3) script viewer

← back to main script listing

gml_Object_obj_board_enemy_bluebird_Step_0

(view raw script w/o annotations or w/e)
1
if (room == room_board_dungeon_2)
2
    active_hitbox = true;
3
updatetimer++;
4
if (updatetimer == 2)
5
{
6
    updatetimer = 0;
7
    path_speed = pathspd;
8
}
9
else
10
{
11
    path_speed = 0;
12
    exit;
13
}
14
scr_board_enemy_step_init
scr_board_enemy_step_init

function
scr_board_enemy_step_init()
{ if (state == "init") state = "move"; }
();
15
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); ...
();
16
scr_board_enemy_hurt_state
scr_board_enemy_hurt_state

function
scr_board_enemy_hurt_state()
{ if (hurttimer > 0) { hurttimer--; active_hitbox = false; if (hurttimer == 0 && hp != maxhp) active_hitbox = true; if (hurttimer == 9 && hp <= 0) { splash = instance_create_depth(centerx(), centery(), depth - 2, obj_board_enemydefeatsplash); splash.depth = depth - 1; global.flag[1255 sword_route_kills]++; obj_board_controller.kris_object.xp += xp_given; instance_destroy(); var a = true; if (object_index == obj_board_enemy_monster && hp == 999) a = false; if (spawnerid != -1 && i_ex(spawnerid) && a == true) { with (spawnerid) instance_destroy(); } if (drop_candy == true) { var drop_rate = 5; if (obj_board_controller.kris_object.myhealth < 8) drop_rate += 20; if (obj_board_controller.kris_object.myhealth < 3) drop_rate += 30; if (obj_board_controller.kris_object.myhealth == obj_board_controller.kris_object.maxhealth) drop_rate = 0; if (irandom(100) < drop_rate || (obj_board_controller.kris_object.monstersdefeated >= 6 && drop_rate > 0) || (obj_board_controller.kris_object.monstersdefeated >= 3 && obj_board_controller.kris_object.myhealth < 3 && drop_rate > 0)) { splash.drop_candy = true; obj_board_controller.kris_object.monstersdefeated = 0; } else { obj_board_controller.kris_object.monstersdefeated++; } } } var dontmove = false; if (object_index == obj_board_enemy_lizard && movecon == 3) dontmove = true; if (hurttimer > 6 && dontmove == false) { if (hitdir == 0) { repeat (20) { if (!place_meeting(x, y + 1, obj_board_solid)) y += 1; else break; } } if (hitdir == 1) { repeat (20) { if (!place_meeting(x + 1, y, obj_board_solid)) x += 1; else break; } } if (hitdir == 2) { repeat (20) { if (!place_meeting(x, y - 1, obj_board_solid)) y -= 1; else break; } } if (hitdir == 3) { repeat (20) { if (!place_meeting(x - 1, y, obj_board_solid)) x -= 1; else break; } } } } if (object_index == obj_board_enemy_lizard && movecon == 3) { if (x < 160) x = 160; if (x > 448) x = 448; if (y < 0) y = 0; if (y > 256) y = 256; } ...
();
17
if (i_ex(obj_board_enemy_bluebird_path))
18
{
19
    target_x = obj_board_enemy_bluebird_path.x;
20
    target_y = obj_board_enemy_bluebird_path.y;
21
}
22
bulletimer++;
23
if (bulletimer == 30 && room != room_board_dungeon_2)
24
{
25
    bulletimer = choose(-60, -30, 0);
26
    bullet = instance_create(x + 16 + lengthdir_x(8, 45), y + 16 + lengthdir_y(8, 45), obj_board_enemy_spear);
27
    bullet.direction = 45;
28
    bullet.image_xscale = 3;
29
    bullet.image_yscale = 3;
30
    bullet.image_speed = 0;
31
    bullet.spd = 16;
32
    bullet.sprite_index = spr_board_blue_bird_feather;
33
    bullet = instance_create(x + 16 + lengthdir_x(8, 135), y + 16 + lengthdir_y(8, 135), obj_board_enemy_spear);
34
    bullet.direction = 135;
35
    bullet.image_xscale = 3;
36
    bullet.image_yscale = 3;
37
    bullet.image_speed = 0;
38
    bullet.spd = 16;
39
    bullet.sprite_index = spr_board_blue_bird_feather;
40
    bullet = instance_create(x + 16 + lengthdir_x(8, 225), y + 16 + lengthdir_y(8, 225), obj_board_enemy_spear);
41
    bullet.direction = 225;
42
    bullet.image_xscale = 3;
43
    bullet.image_yscale = 3;
44
    bullet.image_speed = 0;
45
    bullet.spd = 16;
46
    bullet.sprite_index = spr_board_blue_bird_feather;
47
    bullet = instance_create(x + 16 + lengthdir_x(8, 315), y + 16 + lengthdir_y(8, 315), obj_board_enemy_spear);
48
    bullet.direction = 315;
49
    bullet.image_xscale = 3;
50
    bullet.image_yscale = 3;
51
    bullet.image_speed = 0;
52
    bullet.spd = 16;
53
    bullet.sprite_index = spr_board_blue_bird_feather;
54
}
55
if (room == room_board_dungeon_2)
56
{
57
    if (y != obj_mainchara_board.y && y != 96 && y != 256)
58
        image_index += 1;
59
    else
60
        image_index = 0;
61
    y = obj_mainchara_board.y;
62
    if (obj_mainchara_board.x > (x - 32))
63
        obj_mainchara_board.x = x - 32;
64
}
65
else
66
{
67
    if (!i_ex(obj_board_enemy_bluebird_path) && pathspd > 0)
68
        pathspd -= 0.4;
69
    var path_pos = path_position;
70
    path_end();
71
    x = target_x;
72
    y = target_y;
73
    path_start(path_bluebird2, pathspd, path_action_continue, false);
74
    path_position = path_pos;
75
}
76
if (x < 128)
77
    x = 128;
78
if (x > 480)
79
    x = 480;
80
if (y < 96)
81
    y = 96;
82
if (y > 256)
83
    y = 256;