1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173
|
[prototype]
feet_width="4"
friction="1000"
has_feet="no"
hitpoints="1"
id="helicopter_plant"
mass="5"
on_bounced_on="[if(jumped_on_by.mass >= 1000, die(), animation('spring'))]"
on_child_spawned="if((not vars.rotor), set(vars.rotor, child))"
on_collide_object_body="if(collide_with.vars.team != vars.team and collide_with_area = 'attack', get_hit_by(collide_with))"
on_create="[facing(1), spawn('helicopter_plant.rotor', midpoint_x, y-6, facing), set(accel_y,40), set(target_y, y)]"
on_die="[[score(level,points_value), spawn_item(self), spawn('die_cloud', midpoint_x, midpoint_y, facing)], set(vars.rotor.hitpoints, 0)]"
on_end_chargeup_anim="if(tmp.anim_repeat >= consts.chargeup_repeat, animation('shoot'), [animation('chargeup'), add(tmp.anim_repeat, 1)])"
on_end_hurt_anim="animation('normal')"
on_end_normal_anim="[animation('windup'),
set(tmp.spawn_velocity_x, 10*(90-rotate)),
set(tmp.spawn_velocity_y, 10*(90 - abs(90-rotate)))
]"
on_end_shoot_anim="animation('normal')"
on_end_windup_anim="[animation('chargeup'), set(tmp.anim_repeat, 0)]"
on_enter_anim="set(tmp, 'already_hit', [])"
on_enter_spring_anim="die()"
on_hurtflicker="if(green = 100,[set(green, 255), set(blue, 255)],[set(green, 100), set(blue, 100)])"
on_leave_hurt_anim="[set(green, 255), set(blue, 255)]"
on_process="[set(vars.rotor.midpoint_x, midpoint_x), set(vars.rotor.midpoint_y, y-6)]"
on_process_normal="set(rotate, min(rotate+3, max(rotate-3, if(level.player.midpoint_x < midpoint_x, 180 - target, target))))
where target =
min(90, max(0, (((level.player.midpoint_y - 40) - midpoint_y)*25)/max(2, abs(level.player.midpoint_x - midpoint_x))))"
on_shoot="[spawn('pollen_ball', midpoint_x, midpoint_y, facing,
[
set(zorder, zorder-1),
set(velocity_x, tmp.spawn_velocity_x),
set(velocity_y, tmp.spawn_velocity_y),
]), sound('FlowerShot.ogg')]"
on_surface_damage="die()"
on_swallowed="[set(vars.rotor.hitpoints, 0), animation('normal'), set(rotate, 0), set(type, 'shooting_plant')]"
on_timer="if(y < target_y, set(accel_y, 30), set(accel_y, -10))"
solid_area="5,4,10,10"
springiness="100"
tags="swallowable"
timer_frequency="5"
traction="1000"
traction_in_air="1000"
zorder="0"
[properties]
get_hit_by="def(collide_with) execute(me,
if(not (me in collide_with.tmp.already_hit), [
set(collide_with.tmp, 'already_hit', collide_with.tmp.already_hit + [me]),
if((not is_invincible_posthit) and (collide_with.vars.damage > 0),
if(collide_with.vars.damage > consts.armor,
[
if(me.hitpoints > collide_with.vars.damage,
[
if(collide_with.vars.damage <= consts.flinch_threshold,
schedule(4, [set(me.green, 255), set(me.blue, 255)]),
set(me.animation, 'hurt')),
set(me.green, 100), set(me.blue, 100)
]),
set(me.hitpoints, me.hitpoints - collide_with.vars.damage),
set(tmp.time_last_hit, me.cycle)
])),
if(collide_with.vars.damage > consts.flinch_threshold and me.hurt_velocity_y and (not collide_with.tmp.no_flinch_attack), set(me.velocity_y,(me.hurt_velocity_y))),
if(collide_with.vars.damage > consts.flinch_threshold and me.hurt_velocity_x and (not collide_with.tmp.no_flinch_attack), set(me.velocity_x, ((me.hurt_velocity_x * collide_with.facing + collide_with.velocity_x/2)*collide_with.mass*if(collide_with.attack_force, collide_with.attack_force, 100))/(me.mass*100)))]))"
hurt_velocity_x="400"
hurt_velocity_y="-800"
is_invincible_posthit="if(tmp.time_last_hit and (abs(tmp.time_last_hit - me.cycle) < consts.posthit_invicibility_period), 1, 0)"
[/properties]
[tmp]
anim_repeat="0"
spawn_velocity_x="0"
spawn_velocity_y="0"
time_last_hit="0"
[/tmp]
[vars]
damage="1"
points_value="100"
rotor="null()"
target_y="0"
team="'evil'"
[/vars]
[properties]
hurt_velocity_x="0"
hurt_velocity_y="0"
[/properties]
[animation]
body_area="all"
duration="50"
frame_info="0,0,0,0,340,442,16,15"
frames="1"
frames_per_row="1"
id="normal"
image="compiled-2.png"
rect="340,442,355,456"
[/animation]
[animation]
body_area="all"
duration="50"
frame_info="0,0,0,0,340,442,16,15"
frames="1"
frames_per_row="1"
id="spring"
image="compiled-2.png"
rect="340,442,355,456"
[/animation]
[animation]
body_area="all"
duration="6"
frame_info="1,0,2,0,906,400,13,16"
frames="1"
frames_per_row="1"
id="windup"
image="compiled-0.png"
rect="905,400,920,415"
[/animation]
[animation]
body_area="all"
duration="6"
frame_info="2,0,3,0,253,425,11,17,2,0,3,0,264,425,11,17"
frames="2"
frames_per_row="1"
id="chargeup"
image="compiled-2.png"
rect="251,425,266,441"
[/animation]
[animation]
body_area="all"
duration="20"
events="10:shoot"
frame_info="1,0,1,0,109,458,18,13"
frames="1"
frames_per_row="1"
id="shoot"
image="compiled-2.png"
rect="108,458,127,470"
[/animation]
[animation]
duration="18"
events="6:12:18:hurtflicker"
frames="1"
id="hurt"
[/animation]
[consts]
chargeup_repeat="2"
springiness="160"
[/consts]
[object_type]
id="rotor"
on_end_normal_anim="animation('normal')"
[animation]
duration="4"
frames="4"
frames_per_row="1"
id="normal"
image="enemies/helicopter-plant.png"
rect="70,14,93,21"
[/animation]
[/object_type]
[/prototype]
|