{ id: "mushroom_missile", prototype: ["ant_flying"], hitpoints: 9, solid_area: [9,8,21,16], properties: { altitude_adjustment: "(wave(cycle*5+1000)/30)", handle_flinch: "def(collide_with) [null]", should_charge: "if(animation = 'fly' and level.cycle - 250 > vars.last_charge_end and level.player.y > y - 250 and level.player.y < y + 250 and level.player.x > x - 250 and level.player.x < x + 250, 1, 0)", begin_charge: "def() [ set(vars.behavior, 'charge'), set(vars.charge_start, level.cycle), set(vars.charge_vector, [200 * cos(ang), 200 * sin(ang)]) ] where ang = angle_to(me, level.player)", begin_climb: "def() [set(vars.behavior, 'climb')]", process_charge: "def() [if(level.cycle - 250 < vars.charge_start, [ set(velocity_x, vars.charge_vector[0]), set(velocity_y, vars.charge_vector[1]) ], begin_climb())]", process_climb: "def() [if(y <= vars.desired_height, [ set(vars.behavior,'regular'), set(vars.last_charge_end, level.cycle) ], set(velocity_y, -100))]", }, consts: { basic_type: "mushroom_missile", basic_animation: "fly", size: 32, frogourmet_tag: "mushroom_missile", }, on_create: "[set(vars.behavior,'regular'), if(vars.desired_height = null, set(vars.desired_height, midpoint_y))]", # #Note: the proto will set our y velocity for regular soaring. We only override this if we're busy diving or climbing. on_process_fly: "switch(vars.behavior, 'charge', process_charge(), 'climb', process_climb(), 'regular', [proto_event('ant_flying', 'process_fly'), if(should_charge, begin_charge())])", on_lose_wings: "#don't lose wings#", editor_info: { category: "enemies, experimental", }, animation: [ { image: "enemies/mushroom-missile.png", pad: 3, body_area: "all", attack_area: "all", id: "fly", rect: [1,35,31,65], frames: 4, duration: 5, accel_x: 4, }, { image: "enemies/mushroom-missile.png", pad: 3, body_area: "all", attack_area: "all", id: "turn", rect: [1,1,31,31], frames: 1, duration: 5, }, { image: "enemies/mushroom-missile.png", pad: 3, body_area: "all", attack_area: "all", id: "hurt", rect: [1,1,31,31], frames: 1, duration: 18, }, ], }