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
|
[object_type]
id=bat
on_become_active="if(vars.bat, if(vars.bat.hitpoints <= 0, die(), fire_event(vars.bat, 'restore')))"
on_create="[set(alpha, 0), spawn('bat.instance', midpoint_x, midpoint_y, facing)]"
on_child_spawned="[
set(child.vars.zone_x1, vars.zone_x1),
set(child.vars.zone_x2, vars.zone_x2),
set(child.vars.zone_y1, vars.zone_y1),
set(child.vars.zone_y2, vars.zone_y2),
set(vars.bat, child)
]"
[vars]
bat="null()"
damage=1
team="'evil'"
[/vars]
[editor_info]
category=bugs
[var]
name=zone_x1
type=x
value="x-250"
[/var]
[var]
name=zone_x2
type=x
value="x+260"
[/var]
[var]
name=zone_y1
type=y
value="y-20"
[/var]
[var]
name=zone_y2
type=y
value="y+120"
[/var]
[/editor_info]
[animation]
id="hang"
image="enemies/bat.png"
rect="1,1,18,28"
duration="1000000"
frames="1"
[/animation]
[object_type]
id="instance"
prototype="hittable"
zorder=20
traction_in_air=1000
tags=swallowable
on_enter_thrown_anim="[set(vars.damage, consts.thrown_damage)]"
on_leave_thrown_anim="[set(vars.damage, consts.normal_damage)]"
on_restore="if(animation = 'thrown', set(hitpoints, 0), [if(vars.flying and (not active), [set(vars.flying, 0), animation('hang'), set(x, vars.start_x), set(y, vars.start_y)])])"
on_create="[set(vars.start_x, x), set(vars.start_y, y)]"
on_end_hang_anim="if(level.player.midpoint_x > vars.zone_x1 and level.player.midpoint_x < vars.zone_x2 and level.player.midpoint_y > vars.zone_y1 and level.player.midpoint_y < vars.zone_y2, [set(animation, 'alert'), set(vars.flying, 1)], set(animation, 'hang'))"
on_end_alert_anim="[set(velocity_y, 200), set(accel_y, -2), animation('fly')]"
on_end_fly_anim="animation('fly')"
on_end_hurt_anim="[set(velocity_y, 200), set(accel_y, -2), animation('fly')]"
on_die="[score(level, 10), spawn_item(self), spawn('die_cloud', midpoint_x, midpoint_y, facing)]"
on_collide_object_thrown="
[if(collide_with_area = 'body' and collide_with.vars.team != vars.team,
[if(collide_with.get_hit_by, [collide_with.get_hit_by(me)]), die()])]"
hitpoints=1
[vars]
team="'evil'"
damage=1
zone_x1=0
zone_x2=0
zone_y1=0
zone_y2=0
flying=0
start_x=0
start_y=0
[/vars]
[consts]
normal_damage=1
thrown_damage=5
[/consts]
[base:animation]
body_area=all
[/animation]
[animation]
id="hang"
image="enemies/bat.png"
rect="1,1,18,28"
duration="10"
frames="2"
frames_per_row="2"
pad="3"
accel_x=0
accel_y=0
velocity_x=0
velocity_y=0
[/animation]
[animation]
id="alert"
image="enemies/bat.png"
rect="43,1,60,28"
duration="20"
frames="1"
frames_per_row="1"
pad="0"
[/animation]
[animation]
id="fly"
image="enemies/bat.png"
rect="1,32,26,70"
duration="8"
frames="4"
frames_per_row="4"
pad="3"
reverse="no"
accel_x=-10
attack_area=all
[/animation]
[animation]
id="hurt"
image="enemies/bat.png"
rect="120,32,145,70"
duration="10"
frames="1"
frames_per_row="1"
pad="0"
[/animation]
[animation]
id="thrown"
image="enemies/bat.png"
rect="120,32,145,70"
duration="30"
frames="1"
frames_per_row="1"
pad="0"
accel_y=70
thrown_area=all
body_area=none
[/animation]
[/object_type]
[/object_type]
|