{ id: "red_mosquito_shooter", editor_info: { category: "enemies, experimental", }, activation_border: 1000, prototype: ["ant_flying"], properties: { altitude_adjustment: "(wave(cycle*5+1000)/50)", should_dive: "if(animation = 'fly' and level.player.y > y + 50 and level.player.y < y + 300 and level.player.x > min(x + facing*300, x + facing*1000) and level.player.x < max(x + facing*300, x + facing*1000), 1, 0)", begin_dive: "def() [ set(vars.behavior, 'dive'), set(vars.target_x, level.player.midpoint_x), set(vars.target_y, level.player.y)]", begin_climb: "def() [ set(vars.behavior, 'climb')]", consider_shot: "def() if(player_in_front, shoot() )", shoot: "def() [spawn('red_mosquito_shooter.shot', midpoint_x + 10*facing, midpoint_y, facing, [set(velocity_x, 1600*facing)])]", process_dive: "def() [if(abs(velocity_y) < abs(velocity_x), add(velocity_y, 30)), if(y > level.player.y-20, [consider_shot(),begin_climb()] )]", process_climb: "def() [ if(y <= vars.desired_height, set(vars.behavior,'regular'), if(-velocity_y < abs(velocity_x), set(velocity_y, velocity_y - 30)))]", player_in_front: "(((level.player.midpoint_x - midpoint_x) * facing) > 0)", }, vars: { team: "evil", points_value: 14, damage: 1, }, consts: { basic_type: "red_mosquito", thrown_type: "red_mosquito.thrown", basic_animation: "fly", }, on_create: "set(vars.behavior,'regular')", # #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, 'dive', process_dive(), 'climb', process_climb(), 'regular', [proto_event('ant_flying', 'process_fly'), if(should_dive, begin_dive())])", on_lose_wings: "#don't lose wings#", animation: [ { image: "enemies/mosquito-red.png", pad: 3, body_area: "all", accel_y: 0, id: "fly", rect: [2,2,32,32], frames: 2, duration: 6, accel_x: 13, }, { image: "enemies/mosquito-red.png", pad: 3, body_area: "all", accel_y: 0, id: "spring", rect: [2,36,32,66], frames: 5, duration: 3, }, { image: "enemies/mosquito-red.png", pad: 3, body_area: "all", accel_y: 0, id: "turn", rect: [2,70,32,100], frames: 1, duration: 10, }, { image: "enemies/mosquito-red.png", pad: 3, body_area: "all", accel_y: 0, id: "hurt", rect: [2,2,32,32], }, ], object_type: [ { id: "shot", prototype: ["shot"], traction_in_air: 1000, timer_frequency: 200, on_timer: "die()", animation: { image: "enemies/generic.png", id: "normal", duration: 60, rect: [90,5,102,17], frames: 1, attack_area: "all", accel_x: -30, }, }, { id: "thrown", prototype: ["throwable_small_enemy"], solid_dimensions: ["enemy","common"], consts: { basic_type: "red_mosquito", thrown_type: "red_mosquito.thrown", basic_animation: "fly", }, on_spat: "[proto_event('throwable_small_enemy', 'spat'), set(vars.bomb, null), set(attached_objects, [])]", animation: [ { image: "enemies/generic.png", id: "thrown", thrown_area: "all", duration: 60, rect: [29,1,53,28], frames: 1, body_area: null, }, { image: "enemies/generic.png", id: "on_back", rect: [29,1,53,28], frames: 2, duration: 5, body_area: "all", }, ], }, ], }