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
|
[object_type]
id=red_mosquito
prototype=mosquito
[vars]
team="'evil'"
points_value="50"
damage=1
[/vars]
on_create="[set_var('dive', 0), set_var('soar', 0), set_var('return_y', y)]"
on_process_fly="[set(rotate, if(abs(velocity_x) < 100, 0, (15*velocity_y)/velocity_x)),
if(vars.soar,
[if(y <= vars.return_y, set_var('soar', 0),
if(-velocity_y < abs(velocity_x),
set(velocity_y, velocity_y - 30), null()))],
if(vars.dive, [if(abs(velocity_y) < abs(velocity_x),
set(velocity_y, velocity_y + 30),
null()),
if(y > level.player.y-20 or vars.dive > 90,
[set_var('dive', 0), set_var('soar', 1)],
set_var('dive', vars.dive + 1))],
if(solid(level, front + facing*80, y, 1, y2 - y),
[facing(-facing), animation('turn')],
if(animation = 'fly' and
level.player.y > y + 50 and level.player.y < y + 300 and
level.player.x > min(x + facing*100, x + facing*300) and
level.player.x < max(x + facing*100, x + facing*300),
[set_var('dive', 1),
set_var('target_x',(level.player.x + level.player.x2)/2),
set_var('target_y',level.player.y)],
#make us return to our original height#
if(vars.return_y and y != vars.return_y,
set(velocity_y, velocity_y + if(y < vars.return_y, 15, -15)), null()))))) ]"
on_timer=""
on_end_anim="if(vars.dive = 0 and vars.soar = 0 and
(facing < 0 and x < vars.x_bound or
facing > 0 and x2 > vars.x2_bound),
[facing(-facing), animation('turn')],
animation('fly'))"
[base:animation]
image=enemies/mosquito-red.png
pad=3
body_area=all
[/animation]
[animation]
id=fly
rect=2,2,32,32
frames=2
duration=6
accel_x=15
[/animation]
[animation]
id=spring
rect=2,36,32,66
frames=5
duration=3
[/animation]
[animation]
id=turn
rect=2,70,32,100
frames=1
duration=10
[/animation]
[animation]
id=hurt
rect=2,2,32,32
[/animation]
[/object_type]
|