if (init == 0) { init = 1; if (door_is_open) { var lay = layer_get_id("FAKE_DOOR"); layer_set_visible(lay, false); with (obj_solidblocksized_alt) instance_destroy(); } scr_miniface_init_flowers(); with (obj_mainchara) { with (instance_place(x, y + 20, obj_terracotta_stationary_overworld)) instance_destroy(); } if (global.flag[foxflag] == 0) { pink_fox = scr_makenpc_fromasset(findsprite(spr_dw_garden_fox_idle, "NPCs")); pink_fox.image_speed = 0.25; pink_fox.marker.reflect_jump_y = 26; with (obj_castlereflect_manager) add_reflection(other.pink_fox.marker); scr_setnpclogic(pink_fox, { alwaysanimate: 1, animspeed: 0.25 }, function() { with (obj_mainchara) onebuffer = 5; snd_play(snd_wing); with (pink_fox) { with (instance_create(x - 60, y - 80, obj_animation)) { sprite_index = spr_poof; image_xscale = 2; image_yscale = 2; image_speed = 0.5; } scr_script_delayed(function(arg0) { var t = instance_create(arg0.x, arg0.y + 10, obj_treasure_room); with (obj_castlereflect_manager) { add_reflection(t); substitute_sprite(2144, 1489); add_sprite_offset(2144, 2, 0); } instance_destroy(arg0.marker); instance_destroy(arg0); }, 4, self); } return -1; }); } else { var foxloc = findspriteinfo(spr_dw_garden_fox_idle, "NPCs"); with (instance_create(foxloc.x - 24, foxloc.y - 10, obj_treasure_room)) { with (obj_castlereflect_manager) { add_reflection(other.id); substitute_sprite(2144, 1489); add_sprite_offset(2144, 2, 0); } } } with (obj_item_knock_off_bar) { on_knock_away = function(arg0) { scr_debug_print(string(x)); var targx = x + (0.5 * sprite_width) + random_range(-10, 10); var targy = obj_mainchara.y - 100; with (arg0) { scr_jump_to_point(targx, targy, 12, 30, true); idling = true; t = -24; event_user(1); held = 0; scr_lerpvar("image_angle", 0, 720, 30); } }; set_sprite = false; } if (scr_flag_get_ext(PROGRESS_FLAG, _FOX_BIT_1) == 0) { var gm_fox = scr_genmarker("hiding_fox"); hiding_fox = instance_create(gm_fox.x, gm_fox.y, obj_marker_fancy); with (hiding_fox) { with (obj_castlereflect_manager) { add_reflection(other); add_sprite_offset(2861, 14, 0); } sprite_index = spr_dw_garden_fox_idle; image_speed = 0.25; con = 0; timer = 0; x += 20; hiding_index = 0; scr_darksize(); target_x = 0; target_y = 0; targettime = 0; fake_y = 0; fake_vspeed = 0; step_func = function() { reflect_jump_y = fake_y * -2; }; draw_func = function() { y += fake_y; draw_self(); y -= fake_y; }; } } with (obj_terracotta_stationary_overworld) { if (extflag == "secret_fox" && scr_flag_get_ext(other.PROGRESS_FLAG, other._FOX_BIT_4)) instance_destroy(); if (attack_pattern == 2 && scr_flag_get_ext(other.PROGRESS_FLAG, other._TERA_SKIP_BIT)) instance_destroy(); } with (obj_overworld_foxbullet) { if (freq == 0.12 && is_fox) can_drop = false; } npc_rudinn = scr_makenpc_fromasset(findsprite(spr_enemy_aqua_idle, "NPCs")); foxgarden = scr_genmarker("foxgarden"); foxes_counted = 0; if (instance_exists(npc_rudinn)) { npc_rudinn.dialogue_side = 0; with (obj_castlereflect_manager) { add_reflection(other.npc_rudinn.marker); add_sprite_offset(6109, -2, 0); } } var extrafoxes = [1, 4, 5]; for (var i = 0; i < 3; i++) { var v = extrafoxes[i]; if (scr_flag_get_ext(PROGRESS_FLAG, v) == 1) { with (instance_create(0, 0, obj_overworld_foxbullet)) { fox_index = v; sprite_index = spr_dw_garden_fox_run; var targetx = (other.foxgarden.x - 10) + (10 * other.foxes_counted); var targety = (other.foxgarden.y + 10) - (10 * other.foxes_counted); other.foxes_counted++; held = false; x = targetx; scr_darksize(); xstart = x; y = targety; ystart = y; move_pattern = 4; idling = false; amp_h = 10; } } } scr_setnpclogic(npc_rudinn, { alwaysanimate: true, animspeed: 0.25 }, function(arg0) { if (obj_dw_fcastle_foxhunt.foxes_counted >= 3) { obj_dw_fcastle_foxhunt.encountercon = 1; global.interact = 1; with (obj_darkcontroller) charcon = 0; return -2; } else if (arg0) { if (obj_dw_fcastle_foxhunt.foxes_counted == 1) { scr_speaker("no_name"); msgsetloc(0, "* You've only found 1 fox.&* Can't you find any more?&* Kee hee hee./%", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_163_0"); } else { scr_speaker("no_name"); msgsetsubloc(0, "* You've only found ~1 foxes.&* Can't you find any more?&* Kee hee hee./%", obj_dw_fcastle_foxhunt.foxes_counted, "obj_dw_fcastle_foxhunt_slash_Step_0_gml_166_0"); } } else { scr_speaker("no_name"); msgsetloc(0, "* Kee hee hee^1, Seth said not to let you pass...&* Under any circumstance!/", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_171_0"); msgnextloc("* Unless^1, you found at least \\cY3 foxes\\cW.&* Seth said this./%", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_172_0"); } }); var room_solved = scr_get_bitmask_value(global.flag[PROGRESS_FLAG], _AQUA_BEATEN_BIT, 1, 1); if (room_solved) { with (npc_rudinn.marker) instance_destroy(); with (npc_rudinn) instance_destroy(); with (obj_overworld_foxbullet) { if (fox_index == 0) continue; if (fox_index > 3 || scr_get_bitmask_value(global.flag[other.PROGRESS_FLAG], fox_index, 1, 1)) instance_destroy(); } } else { with (obj_overworld_foxbullet) { if (fox_index >= 1 && fox_index <= 3 && scr_get_bitmask_value(global.flag[other.PROGRESS_FLAG], fox_index, 1, 1) == 1) { var targetx = (other.foxgarden.x - 10) + (10 * other.foxes_counted); var targety = (other.foxgarden.y + 10) - (10 * other.foxes_counted); other.foxes_counted++; held = false; x = targetx; xstart = x; y = targety; ystart = y; move_pattern = 4; idling = false; amp_h = 10; } } } unlock_door(); if (scr_flag_get_ext(PROGRESS_FLAG, _FOX_BIT_5) == 0) { var spr = findspriteinfo(spr_yellow_sock, "NPCs", c_red); npc_shadowguy = instance_create(spr.x, spr.y, obj_marker_fusuma); npc_shadowguy.image_blend = c_white; with (obj_castlereflect_manager) add_reflection(other.npc_shadowguy); with (npc_shadowguy) { sprite_index = spr.sprite_index; image_xscale = spr.image_xscale; image_yscale = spr.image_yscale; __silhouette = 112; __sil_image_speed = 0.02; __sil_image_index = 0; scr_depth(); } var genmarker = scr_genmarker("slide_fusuma"); if (instance_exists(genmarker)) { fusuma_interact = instance_create(genmarker.x, genmarker.y, obj_interactablesolid); fusuma_interact.image_xscale = 6; fusuma_interact.image_yscale = 2; with (fusuma_interact) { on_interact = function() { obj_dw_fcastle_foxhunt.yellow_con = 1; obj_dw_fcastle_foxhunt.yellow_timer = 0; global.interact = 1; }; } } } with (obj_castlereflect_manager) { add_reflection(540); add_sprite_offset(1472, 14, 0); add_sprite_offset(5592, 14, 0); add_sprite_offset(21, 29, 0); add_sprite_offset(3427, 16, -12); add_sprite_offset(4428, 10, 0); add_sprite_offset(4259, 20, 0); substitute_sprite(3427, 1053); } } event_user(1); event_user(2); if (encountercon == 1) { encountercon = 2; global.interact = 1; } if (encountercon == 2) { encountercon = 3; cutscene_master = scr_cutscene_make(); scr_maincharacters_actors(); c_customfunc(function() { with (obj_overworld_foxbullet) { if (scr_onscreen(self) && x < obj_mainchara.x) { idling = true; reflect_jump_y = 0; image_xscale = 2; } } }); npc_rudinn.marker.sprite_index = spr_enemy_aqua_laugh; c_msgside("top"); c_speaker("no_name"); c_msgsetloc(0, "* Kee hee hee.../", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_321_0"); c_msgnextloc("* You found the foxes^1,&you found the foxes!/%", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_322_0"); c_talk_wait(); c_var_instance(npc_rudinn.marker, "sprite_index", spr_enemy_aqua_spin); c_customfunc(function(arg0) { var wait = 1; var wait2 = 10; var yy = 0; with (obj_overworld_foxbullet) { if (scr_onscreen(self) && x < obj_mainchara.x) { scr_script_delayed(function(arg0) { with (arg0[0]) { move_pattern = -1; depth = 16000; skipdepth = true; snd_play(snd_petaldrain, 1, 2); sprite_index = spr_dw_garden_fox_held; var jtp = scr_jump_to_point(arg0[1], arg0[2], 12, 15, false); jtp.customdepth = true; scr_delay_var("sprite_index", 2861, 15); } }, wait, [self, arg0[0], arg0[1] + yy]); wait += 8; yy -= 30; wait2 += 8; } } scr_script_delayed(c_waitcustom_end, wait2); }, [npc_rudinn.x + 40, npc_rudinn.y - 10]); c_waitcustom(); c_wait(5); c_customfunc(function(arg0) { snd_play(snd_wing); with (instance_create(arg0[0].x - 40, arg0[0].y - 160, obj_animation)) { sprite_index = spr_poof; image_xscale = 2; image_yscale = 3; image_speed = 0.5; } }, [npc_rudinn]); c_wait(5); c_customfunc(function(arg0) { with (obj_overworld_foxbullet) { if (idling && scr_onscreen(self)) instance_destroy(); } with (obj_dw_fcastle_foxhunt) { laughing_fox = instance_create(arg0[0].x + 80, arg0[0].y - 40, obj_marker); with (laughing_fox) { with (obj_castlereflect_manager) add_reflection(other.id); sprite_index = spr_tree_fox_laugh; image_xscale = -2; image_yscale = 2; snd_play(snd_creepylaugh); image_speed = 0.5; scr_depth(); } } with (arg0[0].marker) instance_destroy(); with (arg0[0]) instance_destroy(); }, [npc_rudinn]); c_sel(kr); c_facing("l"); c_sel(su); c_sprite(spr_susie_shock); c_sel(ra); c_sprite(spr_ralsei_shocked_left); c_wait(20); c_speaker("no_name"); c_msgsetloc(0, "* But^1, you missed one~/%", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_407_0"); c_talk_wait(); c_actortokris(); c_actortocaterpillar(); c_pannable(0); c_customfunc(function() { scr_caterpillar_interpolate("all"); }); c_terminatekillactors(); } if (encountercon == 3 && !i_ex(obj_cutscene_master)) { global.interact = 0; with (laughing_fox) { image_xscale = 2; x -= sprite_width; touchsprite = sprite_index; whichmonster = 0; myencounter = 229; global.tempflag[54] = 1; } global.flag[PROGRESS_FLAG] = scr_set_bitmask_value(global.flag[PROGRESS_FLAG], _AQUA_BEATEN_BIT, 1, 1); scr_plat_encounter(laughing_fox); encountercon = 4; with (obj_overworld_foxbullet) { if (fox_index > 3) instance_destroy(); } with (laughing_fox) instance_destroy(); } if (obj_darkcontroller.charcon == 1 && scr_trigcheck("depositfox")) obj_darkcontroller.charcon = 0; if ((obj_mainchara.holding_item != -4 && scr_trigcheck("depositfox")) || falling_fox != -4) { var target_fox = falling_fox; if (falling_fox == -4) target_fox = obj_mainchara.holding_item; with (target_fox) { var _is_fox = true; if (object_index == obj_overworld_foxbullet) { if (pickup_style >= 2) _is_fox = false; } if (!_is_fox) break; with (instance_create(x - 80, y - 120, obj_animation)) { sprite_index = spr_poof; image_xscale = 2; depth = other.depth - 10; image_yscale = 2; image_speed = 0.5; } var targetx = (other.foxgarden.x - 10) + (10 * other.foxes_counted); var targety = (other.foxgarden.y + 10) - (10 * other.foxes_counted); held = false; x = targetx; xstart = x; y = targety; ystart = y; other.foxes_counted++; pickup_cooldown = 1000; scr_delay_var("x", targetx, 1); snd_play(snd_wing); var room_solved = scr_get_bitmask_value(global.flag[other.PROGRESS_FLAG], other._AQUA_BEATEN_BIT, 1, 1); if (!room_solved) { with (instance_create(targetx - 80, targety - 120, obj_animation)) { sprite_index = spr_poof; image_xscale = 2; image_yscale = 2; image_speed = 0.5; } } else { y = 100000; ystart = y; targety = y; } scr_delay_var("y", targety, 1); global.flag[other.PROGRESS_FLAG] = scr_set_bitmask_value(global.flag[other.PROGRESS_FLAG], fox_index, 1, 1); other.collect_fox(); move_pattern = 4; idling = false; amp_h = 10; if (other.falling_fox == -4) obj_mainchara.holding_item = -4; other.falling_fox = -4; } } with (obj_floorswitch) { if (pressed && maincharapressable) { with (obj_plat_fusumawall) { if (extflag == other.extflag) { if (extflag == "fusuma1") { if (y < (other.y - 100)) { y = scr_approach(y, ystart - 260, 6); stalk_height = 40 + abs(y - ystart); depth_yoffset = ystart - y; reflect_jump_y = 2 * depth_yoffset; } } else { if (!variable_instance_exists(id, "ttimer")) ttimer = 0; ttimer++; var t = ttimer % 120; if (t < 15) x = xstart + (t * 4); if (t > 45 && t < 75) x = (xstart + 60) - ((t - 45) * 4); if (t > 105) x = (xstart - 60) + ((t - 105) * 4); } } } } else { with (obj_plat_fusumawall) { if (extflag == other.extflag) { if (extflag == "fusuma1") { if (y < (other.y - 100)) { var lasty = y; y = scr_approach(y, ystart, 12); depth_yoffset = ystart - y; reflect_jump_y = 2 * depth_yoffset; stalk_height = 40 + abs(y - ystart); if (y == ystart && y != lasty) snd_play(snd_locker); } } else { } } } } } if (bullet_flip == 0) { if (scr_trigcheck("flip_bullets_1")) { bullet_flip = 1; with (obj_overworld_foxbullet) { if (freq == 0.12 && !held && !idling) scr_lerpvar("timer_inc", timer_inc, -timer_inc, 20); } } } else if (scr_trigcheck("flip_bullets_0")) { bullet_flip = 0; with (obj_overworld_foxbullet) { if (freq == 0.12 && !held && !idling) scr_lerpvar("timer_inc", timer_inc, -timer_inc, 20); } } if (scr_trigcheck("fusuma_scroll")) { var gm_leftbound = scr_genmarker("fusuma_scroll_left"); var gm_rightbound = scr_genmarker("fusuma_scroll_right"); var fusuma_scroll_distance = -320; with (obj_plat_fusumawall) { if (extflag == "fusuma_scroll") x = xstart + (clamp01(inverselerp(gm_leftbound.x, gm_rightbound.x, obj_mainchara.x)) * fusuma_scroll_distance); } } with (hiding_fox) { fake_vspeed += 6.5; fake_y += fake_vspeed; fake_y = min(fake_y, 0); timer++; scr_depth(self); if (direction > 90 && direction < 270) image_xscale = -2; else image_xscale = 2; if (con == 0) { if (point_distance(x, y, mean(obj_mainchara.bbox_left, obj_mainchara.bbox_right), obj_mainchara.bbox_top) < 80) { con = 1; timer = 0; last_x = x; last_y = y; if (hiding_index == 2) { var bit = scr_flag_get_ext(other.PROGRESS_FLAG, other._TERA_SKIP_BIT); with (obj_terracotta_stationary_overworld) { if (extflag == "flank_left" && bit == 0) { attack_pattern = 2; pushable = false; x = xstart + 80; y = ystart; sprite_index = spr_terracotta_overworld_attack_noeyes; with (block) instance_destroy(); with (interact) instance_destroy(); } if (extflag == "flank_right" && bit == 0) { attack_pattern = 2; pushable = false; x = xstart - 80; sprite_index = spr_terracotta_overworld_attack_noeyes; with (block) instance_destroy(); with (interact) instance_destroy(); } if (extflag == "kill_on_reentry") instance_destroy(); } } hiding_index++; snd_play(snd_escaped); var gm = scr_genmarker("foxflee_" + string(hiding_index)); target_x = gm.x + 20; target_y = gm.y + 20; var li = ds_list_create(); collision_rectangle_list(target_x - 40, target_y - 20, target_x + 40, target_y + 60, obj_terracotta_stationary_overworld, false, true, li, false); for (var i = 0; i < ds_list_size(li); i++) instance_destroy(ds_list_find_value(li, i)); ds_list_destroy(li); direction = point_direction(x, y, target_x, target_y); speed = 12; targettime = point_distance(x, y, target_x, target_y) / speed; } } else if (con == 1) { if (fake_y == 0) { snd_play(snd_petaldrain, 0.5, 2); fake_vspeed = -20; } if (timer >= targettime) { x = target_x; y = target_y; speed = 0; con = 0; if (hiding_index == 4) { other.collect_fox(1); instance_destroy(); } } } } if (yellow_con == 1) { yellow_timer++; var opentime = 5; var screamtime = opentime + 25; var pooftime = screamtime + 15; var scream2time = pooftime + 25; var poof2time = scream2time + 15; var closetime = poof2time + 15; var restoretime = closetime + 10; if (yellow_timer == 1) { with (obj_plat_fusumawall) { if (extflag == "sliding_fusuma") scr_lerpvar("x", xstart, xstart - 120, opentime, 1, "out"); } snd_play(snd_wing); with (npc_shadowguy) scr_animate(0, 2, 2 / (closetime - screamtime)); } if (yellow_timer == screamtime) { snd_play(snd_scream, 1, 1); with (npc_shadowguy) { sprite_index = spr_yellow_sockshock; scr_shakeobj(); } } if (yellow_timer == scream2time) { snd_play(snd_scream, 1, 1.2); with (npc_shadowguy) { imaage_index = 0; scr_shakeobj(); } } if (yellow_timer == pooftime || yellow_timer == poof2time) { snd_stop(snd_scream); snd_play(snd_wing); var xx = -50; var yy = -20; if (yellow_timer == poof2time) { xx = -50; yy = -80; } with (instance_create(npc_shadowguy.x + xx, npc_shadowguy.y + yy, obj_animation)) { sprite_index = spr_poof; image_xscale = 2; image_yscale = 2; image_speed = 0.5; depth = 50000; } if (yellow_timer == pooftime) { } else { with (npc_shadowguy) scr_doom(self, 4); other.collect_fox(5); } } if (yellow_timer == (pooftime + 20)) { with (npc_shadowguy) image_index = 1; } if (yellow_timer == (pooftime + 4)) { with (npc_shadowguy) { sprite_index = spr_dw_garden_fox_sock; image_index = 0; x += 20; y += 60; } } if (yellow_timer == closetime) { with (obj_plat_fusumawall) { if (extflag == "sliding_fusuma") scr_lerpvar("x", xstart - 120, xstart, opentime, 1, "out"); } snd_play(snd_wing); with (npc_shadowguy) { scr_delay_var("sprite_index", 8091, restoretime - closetime); scr_delay_var("image_index", 0, restoretime - closetime); } } if (yellow_timer >= restoretime) { global.interact = 0; yellow_con = 0; yellow_timer = 0; with (other.fusuma_interact) instance_destroy(); } } if (i_ex(obj_battlecontroller) && !set_teraskip) { set_teraskip = true; scr_flag_set_ext(PROGRESS_FLAG, _TERA_SKIP_BIT, 1); } if (scr_trigcheck("reset_tera")) reset_tera_skip_bit = true; if (scr_trigcheck("no_reset_tera")) reset_tera_skip_bit = false; if (!door_is_open && room == room_dw_fcastle_foxhunt_terakota) { if (!scr_trigcheck_ext("door_blocked", 1613)) { door_is_open = true; snd_play(snd_locker); scr_shakescreen(); var lay = layer_get_id("FAKE_DOOR"); scr_flag_set_ext(PROGRESS_FLAG, _DOOR_OPEN_BIT, 1); layer_set_visible(lay, false); with (obj_solidblocksized_alt) instance_destroy(); } } if (myinteract == 3) { if (i_ex(mydialoguer) == false) { global.interact = 0; myinteract = 0; with (obj_mainchara) onebuffer = 5; } } if (myinteract == 4 && global.choice >= 0) { k_d(1); if (global.choice == 0) { scr_speaker("susie"); msgsetloc(0, "\\Ey* Yea.../", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_808_0"); scr_anyface_next("ralsei", "y"); msgnextloc("\\Ey* Y..^1. yea.../%", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_810_0"); mydialoguer = d_make(); myinteract = 3; } else { scr_speaker("ralsei"); msgsetloc(0, "\\EK* O-oh...^1! Sorry I made you yell small at me^1, Kris./", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_818_0"); msgnextloc("\\EK* Little^1, um..^1. yell./", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_819_0"); msgnextloc("\\EL* And^1, umm^1, you don't have to keep saying^1, um.../", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_820_0"); msgnextloc("\\EK* \"Exclamation point\" over and over.../", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_821_0"); scr_anyface_next("susie", "y"); msgnextloc("\\Ey* Yea they do./%", "obj_dw_fcastle_foxhunt_slash_Step_0_gml_823_0"); mydialoguer = d_make(); myinteract = 3; } } with (obj_terracotta_stationary_overworld) { if (y >= 1240 && con != -2) { if (!scr_onscreen(self)) { with (block) instance_destroy(); with (interact) instance_destroy(); instance_destroy(); } } }