|
1
|
updatetimer++;
|
|
2
|
if (updatetimer == 2)
|
|
3
|
updatetimer = 0;
|
|
4
|
else
|
|
5
|
exit;
|
|
6
|
if (yoffset > -15)
|
|
7
|
scr_board_enemy_sword_collisionscr_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);
... ();
|
|
8
|
if (hurttimer > 0)
|
|
9
|
{
|
|
10
|
hurttimer--;
|
|
11
|
active_hitbox = false;
|
|
12
|
if (hurttimer == 0 && hp != maxhp)
|
|
13
|
active_hitbox = true;
|
|
14
|
if (hurttimer == 9 && hp <= 0)
|
|
15
|
{
|
|
16
|
splash = instance_create_depth(centerx(), centery() - 6, depth - 2, obj_board_enemydefeatsplash);
|
|
17
|
splash.depth = depth - 1;
|
|
18
|
global.flag[1255 sword_route_kills]++;
|
|
19
|
obj_board_controller.kris_object.xp += xp_given;
|
|
20
|
instance_destroy();
|
|
21
|
var a = true;
|
|
22
|
if (object_index == obj_board_enemy_monster && hp == 999)
|
|
23
|
a = false;
|
|
24
|
if (spawnerid != -1 && i_ex(spawnerid) && a == true)
|
|
25
|
{
|
|
26
|
with (spawnerid)
|
|
27
|
instance_destroy();
|
|
28
|
}
|
|
29
|
if (drop_candy == true)
|
|
30
|
{
|
|
31
|
var drop_rate = 5;
|
|
32
|
if (obj_board_controller.kris_object.myhealth < 8)
|
|
33
|
drop_rate += 20;
|
|
34
|
if (obj_board_controller.kris_object.myhealth < 3)
|
|
35
|
drop_rate += 30;
|
|
36
|
if (obj_board_controller.kris_object.myhealth == obj_board_controller.kris_object.maxhealth)
|
|
37
|
drop_rate = 0;
|
|
38
|
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))
|
|
39
|
{
|
|
40
|
splash.drop_candy = true;
|
|
41
|
obj_board_controller.kris_object.monstersdefeated = 0;
|
|
42
|
}
|
|
43
|
else
|
|
44
|
{
|
|
45
|
obj_board_controller.kris_object.monstersdefeated++;
|
|
46
|
}
|
|
47
|
}
|
|
48
|
}
|
|
49
|
}
|
|
50
|
if (movecon == -1)
|
|
51
|
{
|
|
52
|
if (movetimer > -50 && movetimer < -30)
|
|
53
|
{
|
|
54
|
image_index += lerp(0, 1, (movetimer + 30) / -20);
|
|
55
|
yoffset = round(lerp(0, -24, (movetimer + 30) / -20) / 2) * 2;
|
|
56
|
}
|
|
57
|
if (movetimer > -30 && movetimer < -20)
|
|
58
|
image_index = 1;
|
|
59
|
if (movetimer > -20 && movetimer < 0)
|
|
60
|
image_index += lerp(1, 0, movetimer / -20);
|
|
61
|
if (movetimer > -10 && movetimer < 0)
|
|
62
|
yoffset = round(lerp(-24, 0, movetimer / -10) / 2) * 2;
|
|
63
|
if (movetimer == -1)
|
|
64
|
{
|
|
65
|
startingx = x;
|
|
66
|
startingy = y;
|
|
67
|
var rand = choose(0, 1, 2, 3, 4, 5);
|
|
68
|
if (randprev == rand)
|
|
69
|
rand++;
|
|
70
|
if (rand > 5)
|
|
71
|
rand = 0;
|
|
72
|
randprev = rand;
|
|
73
|
if (rand == 0)
|
|
74
|
{
|
|
75
|
destinationx = 448;
|
|
76
|
destinationy = 256;
|
|
77
|
}
|
|
78
|
if (rand == 1)
|
|
79
|
{
|
|
80
|
destinationx = 160;
|
|
81
|
destinationy = 256;
|
|
82
|
}
|
|
83
|
if (rand == 2)
|
|
84
|
{
|
|
85
|
destinationx = 160;
|
|
86
|
destinationy = 96;
|
|
87
|
}
|
|
88
|
if (rand == 3)
|
|
89
|
{
|
|
90
|
destinationx = 448;
|
|
91
|
destinationy = 96;
|
|
92
|
}
|
|
93
|
if (rand == 4)
|
|
94
|
{
|
|
95
|
destinationx = 256;
|
|
96
|
destinationy = 160;
|
|
97
|
}
|
|
98
|
if (rand == 5)
|
|
99
|
{
|
|
100
|
destinationx = 352;
|
|
101
|
destinationy = 192;
|
|
102
|
}
|
|
103
|
distance = point_distance(startingx, startingy, destinationx, destinationy) / 5.3;
|
|
104
|
}
|
|
105
|
if (movetimer >= 0)
|
|
106
|
{
|
|
107
|
if (con == 0 && movespd < 2)
|
|
108
|
movespd += 0.1;
|
|
109
|
if (con == 1 && movespd > 0.3)
|
|
110
|
movespd -= 0.1;
|
|
111
|
if (movecon == -1 && movetimer >= (distance - (11 * movespd)))
|
|
112
|
con = 1;
|
|
113
|
movetimer += movespd;
|
|
114
|
image_index++;
|
|
115
|
if (movetimer > distance)
|
|
116
|
movetimer = distance;
|
|
117
|
x = lerp(startingx, destinationx, movetimer / distance);
|
|
118
|
y = lerp(startingy, destinationy, movetimer / distance);
|
|
119
|
if (movetimer >= distance)
|
|
120
|
{
|
|
121
|
movetimer = -50;
|
|
122
|
con = 0;
|
|
123
|
movespd = 0;
|
|
124
|
image_index = 0;
|
|
125
|
}
|
|
126
|
}
|
|
127
|
else
|
|
128
|
{
|
|
129
|
movetimer++;
|
|
130
|
}
|
|
131
|
}
|