1
by Dmitry E. Oboukhov
Import upstream version 1.0 |
1 |
[object_type]
|
2 |
id=bat |
|
3 |
||
4 |
on_become_active="if(vars.bat, if(vars.bat.hitpoints <= 0, die(), fire_event(vars.bat, 'restore')))" |
|
5 |
on_create="[set(alpha, 0), spawn('bat.instance', midpoint_x, midpoint_y, facing)]"
|
|
6 |
||
7 |
on_child_spawned="[ |
|
8 |
set(child.vars.zone_x1, vars.zone_x1),
|
|
9 |
set(child.vars.zone_x2, vars.zone_x2),
|
|
10 |
set(child.vars.zone_y1, vars.zone_y1),
|
|
11 |
set(child.vars.zone_y2, vars.zone_y2),
|
|
12 |
set(vars.bat, child)
|
|
13 |
]"
|
|
14 |
||
15 |
[vars]
|
|
16 |
bat="null()" |
|
17 |
damage=1
|
|
18 |
team="'evil'"
|
|
19 |
[/vars]
|
|
20 |
||
21 |
||
22 |
[editor_info]
|
|
23 |
category=bugs |
|
24 |
[var]
|
|
25 |
name=zone_x1
|
|
26 |
type=x
|
|
27 |
value="x-250"
|
|
28 |
[/var]
|
|
29 |
[var]
|
|
30 |
name=zone_x2
|
|
31 |
type=x
|
|
32 |
value="x+260"
|
|
33 |
[/var]
|
|
34 |
[var]
|
|
35 |
name=zone_y1
|
|
36 |
type=y
|
|
37 |
value="y-20"
|
|
38 |
[/var]
|
|
39 |
[var]
|
|
40 |
name=zone_y2
|
|
41 |
type=y
|
|
42 |
value="y+120"
|
|
43 |
[/var]
|
|
44 |
[/editor_info]
|
|
45 |
||
46 |
[animation]
|
|
47 |
id="hang" |
|
48 |
image="enemies/bat.png"
|
|
49 |
rect="1,1,18,28"
|
|
50 |
duration="1000000"
|
|
51 |
frames="1"
|
|
52 |
[/animation]
|
|
53 |
||
54 |
[object_type]
|
|
55 |
id="instance" |
|
56 |
prototype="hittable" |
|
57 |
||
58 |
zorder=20 |
|
59 |
traction_in_air=1000 |
|
60 |
tags=swallowable |
|
61 |
||
62 |
on_enter_thrown_anim="[set(vars.damage, consts.thrown_damage)]" |
|
63 |
on_leave_thrown_anim="[set(vars.damage, consts.normal_damage)]" |
|
64 |
||
65 |
||
66 |
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)])])" |
|
67 |
||
68 |
on_create="[set(vars.start_x, x), set(vars.start_y, y)]" |
|
69 |
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'))" |
|
70 |
on_end_alert_anim="[set(velocity_y, 200), set(accel_y, -2), animation('fly')]" |
|
71 |
on_end_fly_anim="animation('fly')" |
|
72 |
on_end_hurt_anim="[set(velocity_y, 200), set(accel_y, -2), animation('fly')]" |
|
73 |
on_die="[score(level, 10), spawn_item(self), spawn('die_cloud', midpoint_x, midpoint_y, facing)]" |
|
74 |
||
75 |
on_collide_object_thrown=" |
|
76 |
[if(collide_with_area = 'body' and collide_with.vars.team != vars.team,
|
|
77 |
[if(collide_with.get_hit_by, [collide_with.get_hit_by(me)]), die()])]"
|
|
78 |
||
79 |
hitpoints=1 |
|
80 |
[vars]
|
|
81 |
team="'evil'"
|
|
82 |
damage=1
|
|
83 |
zone_x1=0
|
|
84 |
zone_x2=0
|
|
85 |
zone_y1=0
|
|
86 |
zone_y2=0
|
|
87 |
flying=0
|
|
88 |
start_x=0
|
|
89 |
start_y=0
|
|
90 |
[/vars]
|
|
91 |
||
92 |
[consts]
|
|
93 |
normal_damage=1 |
|
94 |
thrown_damage=5
|
|
95 |
[/consts]
|
|
96 |
||
97 |
[base:animation]
|
|
98 |
body_area=all |
|
99 |
[/animation]
|
|
100 |
||
101 |
[animation]
|
|
102 |
id="hang" |
|
103 |
image="enemies/bat.png"
|
|
104 |
rect="1,1,18,28"
|
|
105 |
duration="10"
|
|
106 |
frames="2"
|
|
107 |
frames_per_row="2"
|
|
108 |
pad="3"
|
|
109 |
accel_x=0
|
|
110 |
accel_y=0
|
|
111 |
velocity_x=0
|
|
112 |
velocity_y=0
|
|
113 |
[/animation]
|
|
114 |
||
115 |
[animation]
|
|
116 |
id="alert" |
|
117 |
image="enemies/bat.png"
|
|
118 |
rect="43,1,60,28"
|
|
119 |
duration="20"
|
|
120 |
frames="1"
|
|
121 |
frames_per_row="1"
|
|
122 |
pad="0"
|
|
123 |
[/animation]
|
|
124 |
||
125 |
[animation]
|
|
126 |
id="fly" |
|
127 |
image="enemies/bat.png"
|
|
128 |
rect="1,32,26,70"
|
|
129 |
duration="8"
|
|
130 |
frames="4"
|
|
131 |
frames_per_row="4"
|
|
132 |
pad="3"
|
|
133 |
reverse="no"
|
|
134 |
accel_x=-10
|
|
135 |
attack_area=all
|
|
136 |
[/animation]
|
|
137 |
||
138 |
[animation]
|
|
139 |
id="hurt" |
|
140 |
image="enemies/bat.png"
|
|
141 |
rect="120,32,145,70"
|
|
142 |
duration="10"
|
|
143 |
frames="1"
|
|
144 |
frames_per_row="1"
|
|
145 |
pad="0"
|
|
146 |
[/animation]
|
|
147 |
||
148 |
[animation]
|
|
149 |
id="thrown" |
|
150 |
image="enemies/bat.png"
|
|
151 |
rect="120,32,145,70"
|
|
152 |
duration="30"
|
|
153 |
frames="1"
|
|
154 |
frames_per_row="1"
|
|
155 |
pad="0"
|
|
156 |
accel_y=70
|
|
157 |
thrown_area=all
|
|
158 |
body_area=none
|
|
159 |
[/animation]
|
|
160 |
||
161 |
[/object_type]
|
|
162 |
||
163 |
[/object_type]
|