1{ 2id: "finch", 3activation_border: 1000, 4prototype: ["ant_flying"], 5dies_on_inactive: true, 6properties: { 7 try_facing: "def(direction) if(direction != facing,fire_event('turn'))", 8 sine_magnitude: "abs(vars.desired_height - vars.magnitude)", 9 shooting_appropriate: "if( (abs(mid_y - level.player.mid_y) < 20) and (level.cycle - vars.last_fired) > 50 and (facing = sign(level.player.mid_x - mid_x)),1,0)", 10}, 11vars: { 12 points_value: 14, 13}, 14consts: { 15 basic_type: "finch", 16 thrown_type: "finch.thrown", 17 basic_animation: "fly", 18 frogourmet_tag: "finch", 19}, 20on_spawned: "set(facing,if(level.player.mid_x < mid_x, -1, 1))", 21 22on_create: "[ set(vars.randphase, 1d500), 23 set(vars.init_y, midpoint_y), 24 set(vars.init_x, midpoint_x) 25 ]", 26on_test_bounds: "#do nothing#", 27 28on_process_fly: "[ 29 set(velocity_y, wave( min(250,max(-250, destination_height-midpoint_y ) ) )) ] where destination_height = vars.desired_height + (sin(cycle*2 + vars.randphase)*sine_magnitude)", 30on_process_turn: "fire_event('process_fly')", 31on_lose_wings: "#don't lose wings#", 32 33solid_area: null, 34editor_info: { 35 category: "enemies, experimental", 36 var: [ 37 { 38 name: "desired_height", 39 type: "y", 40 value: "midpoint_y", 41 }, 42 { 43 name: "magnitude", 44 type: "y", 45 value: "midpoint_y+300", 46 }, 47 ], 48}, 49animation: [ 50 { 51 "@base": true, 52 image: "enemies/bat-black.png", 53 pad: 3, 54 body_area: "all", 55 accel_y: 0, 56 feet_x: 12, 57 feet_y: 25, 58 accel_x: 0, 59 60 }, 61 { 62 id: "fly", 63 rect: [1,32,26,70], 64 frames: 4, 65 duration: 4, 66 accel_x: 9, 67 }, 68 { 69 id: "spring", 70 rect: [1,32,26,70], 71 frames: 1, 72 duration: 3, 73 }, 74 { 75 id: "turn", 76 rect: [1,74,26,112], 77 frames: 2, 78 duration: 3, 79 }, 80 { 81 id: "hurt", 82 rect: [120,32,145,70], 83 }, 84], 85object_type: [ 86 { 87 id: "shot", 88 prototype: ["shot"], 89 traction_in_air: 1000, 90 timer_frequency: 200, 91 on_timer: "die()", 92 animation: { 93 image: "enemies/generic.png", 94 id: "normal", 95 duration: 60, 96 rect: [90,5,102,17], 97 frames: 1, 98 attack_area: "all", 99 accel_x: 20, 100 }, 101 }, 102 { 103 id: "thrown", 104 prototype: ["throwable_small_enemy"], 105 solid_dimensions: ["enemy","common"], 106 consts: { 107 basic_type: "finch", 108 thrown_type: "finch.thrown", 109 basic_animation: "fly", 110 frogourmet_tag: "finch", 111 }, 112 113 #specifically trigger death here because non-solid objects don't have a water-level 114 on_enter_water: "die()", 115 on_die: "[score(level,points_value), spawn_item(self), death_burst_tracked(self)]", 116 animation: [ 117 { 118 image: "enemies/bat-black.png", 119 id: "thrown", 120 thrown_area: "all", 121 duration: 60, 122 rect: [149,32,174,70], 123 frames: 1, 124 body_area: null, 125 }, 126 { 127 image: "enemies/bat-black.png", 128 id: "on_back", 129 rect: [149,32,174,70], 130 frames: 2, 131 duration: 5, 132 body_area: "all", 133 }, 134 ], 135 }, 136], 137}