if (con == -1 && scr_trigcheck_ext("leafling", 1164)) con = 0; if (con == 0) { timer++; var lastx = x; var lasty = y; x = xstart + (sin(degtorad(startphase + (timer * 3))) * 140); y += (sin(degtorad(((startphase + (timer * 2)) % 90) * 2)) * 3); var dist = point_distance(x, y, lastx, lasty); image_speed = 0.15 * abs(dist); if (x > lastx) image_xscale = -2; else image_xscale = 2; if (i_ex(obj_climb_kris) && obj_climb_kris.y < (y - 60)) { con = 1; timer = 0; snd_play(snd_b); var targalarm = 8; var excl = instance_create(x, y - (0.5 * sprite_height) - 40, obj_excblcon); excl.alarm[0] = targalarm; if (x < obj_climb_kris.x) image_xscale = -2; else image_xscale = 2; gravity_direction = 90; targetwind = 2; scr_vfx_windboost(90); } } else if (con == 1 && i_ex(obj_climb_kris)) { timer++; if (timer == 16) { var pdir = point_direction(x, y, obj_climb_kris.x, obj_climb_kris.y); speed = 8; direction = pdir; gravity = 0.2; } if (y < (cameray() - 100)) { y = cameray() - 100; gravity = 0; vspeed = 0; hspeed = 0; con = 0; timer = 0; } } if (!i_ex(obj_climb_kris)) con = -1; visible = con >= 0; if (!encountered && place_meeting(x, y, obj_climb_kris)) { encountered = true; sprite_index = spr_leafling_flydown; x -= (0.5 * sprite_width); y -= (0.5 * sprite_height); if (image_xscale == -2) x += sprite_width; with (obj_climb_kris) { if (jumpchargecon > 0) { image_blend = c_white; if (jumpchargesfx != -4) snd_stop(jumpchargesfx); button2buffer = 10; jumpchargecon = 0; jumpchargetimer = 0; jumpchargecon = 0; neutralcon = 1; } freeze = true; obj_mainchara.x = x; obj_mainchara.y = y; with (obj_caterpillarchara) { x = other.x; y = other.y; } } depth = obj_climb_kris.depth - 1; scr_plat_encounter(self); instance_destroy(); }