1{
2id: "airplane-boss",
3prototype: ["hittable"],
4always_active: true,
5hitpoints: 1201,   #400 * 3 + 1
6
7
8mass: 5,
9ignore_collide: true,
10traction_in_air: 1000,
11properties: {
12	team: "'evil'",
13	boss_hitpoints: "hitpoints-1",
14	boss_max_hitpoints: "max_hitpoints-1",
15	armor: 400,
16	flinch_threshold: 9999999,
17},
18vars: {
19
20	#left_bound=-300
21	#right_bound=1000
22	#left_bound_missile=-100
23	#right_bound_missile=900
24	heights: [70,210,270],
25	heights_index: 0,
26	pilot: null,
27	strafing: -1,
28	points_value: 2000,
29},
30on_create: "[animation('fly'),sound_loop('loops/PlaneFlyBy.ogg'),add_particles('smoke'),
31	            set(attached_objects, [pilot]),
32				set(vars.pilot, pilot),
33				set(vars.left_bound, 400-level.camera_position[2]/2-300),
34				set(vars.right_bound, 400+level.camera_position[2]/2+300),
35				set(vars.left_bound_missile, 400-level.camera_position[2]/2-100),
36				set(vars.right_bound_missile, 400+level.camera_position[2]/2+100),
37				map(level.gui, set(value.vars.bosses, value.vars.bosses + [me]))
38				]
39				  where pilot = object('kitty_pilot', x, y, facing)",
40on_end_anim: "animation('fly')",
41on_die: "[set(level.boss_killed, 1)]",
42on_process: "[set(vars.pilot.midpoint_x, midpoint_x),
43	             set(vars.pilot.midpoint_y, midpoint_y-10),
44				 set(vars.pilot.facing, facing),
45	         if(hitpoints = 1 and (cycle%10 =1),
46	             [spawn('explosion_big',  midpoint_x + 1d50 - 1d50, midpoint_y + 1d70 - 1d70, -facing),sound('BombExplode.wav')]),
47
48	               if(facing < 0 and x < left_bound or facing > 0 and x > right_bound,
49	               [set(vars.strafing, -1), facing(-facing), animation('fly'), set(velocity_x, 0), set(y, heights[vars.heights_index%3]), set(vars.heights_index, vars.heights_index+1), if(hitpoints = 1, die())])]",
50timer_frequency: 20,
51on_timer: "[
52	     if(hitpoints > 1 and x > left_bound_missile and x2 < right_bound_missile and cycle > 200,
53	          if(vars.strafing > 0, [set(vars.strafing, vars.strafing - 1),
54				if(1d2=2,
55					spawn('airplane-boss.dud_bomb', midpoint_x, midpoint_y+40, facing, [set(velocity_x, velocity_x)]),
56					spawn('airplane-boss.bomb', midpoint_x, midpoint_y+40, facing, [set(velocity_x, velocity_x)]))
57                ,sound('MissileDrop.wav')],
58				if(vars.strafing = -1 and (level.player.midpoint_x - midpoint_x)*facing < (200 + (level.player.y - y)), [set(vars.strafing, 8)])))
59				]",
60passenger_x: 20,
61passenger_y: 12,
62zorder: -10,
63animation: [
64	{
65		image: "vehicles/plane-milgram.png",
66		pad: 3,
67		body_area: "all",
68		id: "stand",
69		rect: [11,2,79,70],
70		frames: 1,
71		duration: 100000,
72	},
73	{
74		image: "vehicles/plane-milgram.png",
75		pad: 3,
76		body_area: "all",
77		id: "fly",
78		rect: [94,2,162,70],
79		frames: 4,
80		duration: 1,
81		accel_x: 8,
82	},
83],
84particle_system: {
85	id: "smoke",
86	type: "simple",
87	spawn_rate: 100,
88	time_to_live: 100,
89	min_x: 10,
90	max_x: 10,
91	min_y: 94,
92	max_y: 104,
93	velocity_y: -400,
94	velocity_x: 260,
95	velocity_x_random: 200,
96	velocity_y_random: 800,
97
98	#color=255,255,255,255
99	delta_a: 8,
100	animation: {
101		id: "sparkle",
102		image: "effects/explosion.png",
103		x: 198,
104		y: 5,
105		w: 17,
106		h: 16,
107		pad: 3,
108		frames: 8,
109		frames_per_row: 2,
110		scale: 2,
111		duration: 6,
112	},
113},
114object_type: [
115	{
116		id: "bomb",
117		properties: {
118			attack_damage: 1,
119			damage_cooldown: 5,
120			team: "'evil'",
121			left_bound: "480 - screen_w/2 where screen_w = level.camera_position[2]",
122			right_bound: "480 + screen_w/2 where screen_w = level.camera_position[2]",
123		},
124		on_create: "animation('fall')",
125		on_collide_object: "if(team != collide_with.team, fire_event('explode'))",
126		on_collide_head: "fire_event('explode')",
127		on_collide_feet: "fire_event('explode')",
128		on_end_fall_anim: "animation('dangerous')",
129		on_explode: "[spawn('explosion_spark_bright',midpoint_x,midpoint_y,facing), spawn('explosion_big',midpoint_x,midpoint_y,facing),sound('BombExplode.wav'),die()]",
130		on_process_fall: "[set(rotate, rotate + facing*3)]",
131		on_process: "[if((mid_x < left_bound + 20) or (mid_x > right_bound -20),remove_object(me))]",
132		dies_on_inactive: true,
133		animation: [
134			{
135				id: "fall",
136				image: "vehicles/plane.png",
137				attack_area: "all",
138				x: 11,
139				y: 90,
140				w: 39,
141				h: 39,
142				frames: 1,
143				pad: 3,
144				duration: 20,
145				accel_y: 50,
146			},
147			{
148				attack_area: "all",
149				id: "dangerous",
150				image: "vehicles/plane.png",
151				x: 11,
152				y: 90,
153				w: 39,
154				h: 39,
155				frames: 2,
156				pad: 3,
157				duration: 10000,
158			},
159		],
160	},
161	{
162		id: "dud_bomb",
163		prototype: ["throwable"],
164		properties: {
165			team: "if(animation in ['fall','dangerous','sitting','dying'],'evil','player')",
166			attack_damage: "if(animation in ['thrown'], standard_thrown_damage, 0)",
167			left_bound: "480 - screen_w/2 where screen_w = level.camera_position[2]",
168			right_bound: "480 + screen_w/2 where screen_w = level.camera_position[2]",
169		},
170		on_create: "animation('fall')",
171		on_collide_head: "fire_event('explode')",
172		on_collide_feet: "if(standing_on.team = 'player', die(), [set(velocity_y,0),set(velocity_x,0),animation('sitting'), set(collide_dimensions_in, ['common'])])",
173		on_collide_side: "fire_event('explode')",
174		on_end_fall_anim: "animation('dangerous')",
175		on_end_sitting_anim: "animation('dying')",
176		on_process_dying: "if(cycle%2,set(brightness,1000),set(brightness,155))",
177		on_end_dying_anim: "die()",
178		on_die: "[spawn('explosion_spark_bright',midpoint_x,midpoint_y,facing), ##]",
179		on_explode: "[spawn('explosion_big',midpoint_x,midpoint_y,facing),sound('BombExplode.wav'),die()]",
180		on_spat: "set(brightness,255)",
181		on_process_fall: "[set(rotate, rotate + facing*3)]",
182		on_process: "[if((mid_x < left_bound + 20) or (mid_x > right_bound -20),remove_object(me))]",
183		always_active: true,
184		dies_on_inactive: true,
185		solid_area: [15,15,20,22],
186		animation: [
187			{
188				"@base": true,
189				image: "vehicles/plane.png",
190				x: 11,
191				y: 90,
192				w: 39,
193				h: 39,
194				pad: 3,
195				accel_y: 50,
196				frames: 1,
197				body_area: [15,10,30,25,"solid"]
198			},
199			{
200				id: "fall",
201				duration: 18,
202				attack_area: "all",
203			},
204			{
205				id: "thrown",
206				thrown_area: "all",
207				solid_area: null,
208				duration: 10000,
209			},
210			{
211				attack_area: "all",
212				id: "dangerous",
213				frames: 1,
214				duration: 10000,
215			},
216			{
217				id: "sitting",
218				duration: 80,
219			},
220			{
221				id: "dying",
222				duration: 20,
223			},
224		],
225	},
226],
227}
228