1{
2includes: "score",
3no_compile_image: "gui/progress-bar-center.png,gui/progress-bar-endcaps.png,gui/progress-bar-well-center.png",
4on_process: "[
5	if(object.vars.coins != level.local_player.vars.coins*100, set(object.vars.coins, object.vars.coins + diff/20 + if(diff > 0, 1, -1)) where diff = level.local_player.vars.coins*100 - object.vars.coins),
6
7	if(object.vars.coins = null, set(object.vars.coins, level.local_player.vars.coins*100)),
8
9    if(object.vars.bosses or object.vars.boss_hitpoints,
10	   [if(target_hitpoints <= 0, set(objects.vars.bosses, [])),
11	    if(object.vars.boss_hitpoints != target_hitpoints,
12			# make the bar fill up asymptotically (filling another half every cycle) so that it looks cool and smooth, but cap this once the divisions reach roughly 1 pixel in size, so it doesn't take infinite time.  This provides the looks cool benefits of gradually filling the bar, with an immediate sense of how far the current motion is going to reach (since humans are good at intuitively judging rates of change).#
13			 set(object.vars.boss_hitpoints,
14			         if(   abs(target_hitpoints - object.vars.boss_hitpoints) < 0.001, target_hitpoints, object.vars.boss_hitpoints + (target_hitpoints - object.vars.boss_hitpoints)*0.15 )))
15	    ] where target_hitpoints = if(object.vars.bosses, (sum(map(object.vars.bosses, if(value.boss_hitpoints != null, value.boss_hitpoints, value.hitpoints))))/decimal(sum(map(object.vars.bosses, if(value.boss_max_hitpoints != null, value.boss_max_hitpoints, value.max_hitpoints)))), 0)),
16
17	if(object.vars.powerup_time != level.local_player.vars.powerup_time,
18		    set(object.vars.powerup_time, object.vars.powerup_time + max(-2, min(10, level.local_player.vars.powerup_time - object.vars.powerup_time)))
19	    ),
20	]",
21on_draw: "if(level.local_player.type = 'invisible_observer',  /*then draw absolutely nothing */	null,
22		[
23		draw_animation('gold_background', 178, 10),
24		draw_number(object.vars.coins, 5, 202, 14),
25
26	if(level.local_player.type = 'frogatto_playable',
27
28		switch(level.local_player.vars.ability_list[level.local_player.vars.current_ability],
29			 'tongue', 			draw_animation('frogatto_tongue_portrait', 10, 10),
30			 'firebreath', 		draw_animation('frogatto_firebreath_portrait', 10, 10),
31			 'energyshot',		draw_animation('frogatto_energyshot_portrait', 10, 10),
32			 'homingshot',		draw_animation('frogatto_homingshot_portrait', 10, 10),
33								draw_animation('frogatto_portrait', 10, 10))),
34
35	draw_animation('manabar_empty', 48, 32),
36
37	[if(level.local_player.vars.mana > 0,
38	 	[	draw_animation('charge_bar_left', x_offset, y_offset),
39			draw_animation('charge_bar_right', x_offset + barLength*2, y_offset),
40			if(barLength > 5, draw_animation_area('charge_bar_center', x_offset+10, y_offset, barLength-5))
41
42		   ] where x_offset = 52 where y_offset = 32 where barLength = integer((fullBarLength * level.local_player.vars.mana)/level.local_player.vars.max_mana) )
43	 ] where fullBarLength = 114,
44
45
46
47# Display rows of hearts.#
48	[map(range( ceiling(max_HP/decimal(hearts_per_row * hp_per_heart))), 'row_index',
49    slice(
50    map(range(hearts_per_row), 'index', draw_animation('heart_full', x_offset+x_width*index, y_offset+y_height*row_index)),
51    	0, max(0, min(hearts_per_row, (cur_HP)/hp_per_heart - hearts_per_row*row_index)    ))),
52
53	map(range( ceiling(max_HP/decimal(hearts_per_row * hp_per_heart))), 'row_index',
54    slice(
55    map(range(hearts_per_row), 'index', draw_animation('heart_empty', x_offset+x_width*index, y_offset+y_height*row_index)),
56    	max(0,min(hearts_per_row, (cur_HP)/hp_per_heart - hearts_per_row*row_index)), min(hearts_per_row, ceiling((max_HP)/decimal(hp_per_heart)) - hearts_per_row*row_index) )),
57
58    if(cur_HP > 0 and cur_HP%hp_per_heart,
59    map(range(hearts_per_row), 'index', draw_animation('heart_half', x_offset+x_width*index, y_offset+y_height*row_index)) [cur_HP/hp_per_heart - row_index*(hearts_per_row)])
60    where row_index = cur_HP/(hearts_per_row * hp_per_heart)
61
62	] where x_offset = 10 where y_offset = 52 where x_width = 32 where y_height = 32 where hp_per_heart = 2 where hearts_per_row = 10 where ceiling = def(val) (if(val <= integer(val), integer(val), integer(val)+1)) where max_HP = level.local_player.max_hitpoints where cur_HP = level.local_player.hitpoints,
63
64
65
66
67	if(level.local_player.consts.tank_size, [draw_animation('bar_frame', 10, 50),
68	map(range(max(0, (level.local_player.vars.tank_fuel*4)/level.local_player.consts.tank_size)), 'n', draw_animation('bar_element', 14 + n*20, 54))]),
69
70	if(energy_charge > 0,
71		if(energy_charge < 20,
72		   [draw_animation_area('charge_bar_left', 14, 52, energy_charge/4),
73		    draw_animation_area('charge_bar_right', 12 + energy_charge/2, 52, 5 - energy_charge/4, 0, energy_charge/4, 5)],
74		   [
75		    draw_animation('charge_bar_left', 14, 52),
76		    draw_animation('charge_bar_right', 14 + energy_charge - 12, 52),
77	        draw_animation_area('charge_bar_center', 14 + 10, 52, (energy_charge - 20)/2)
78		   ]
79	    )
80	 )
81     where energy_charge = if(level.local_player.vars.charge_time = 0, 0, (level.local_player.energy_charge*75)/level.local_player.vars.charge_time - 5),
82
83
84	if(object.vars.boss_hitpoints,
85		 [draw_animation('charge_bar_well_left', well_start, SCREEN_HEIGHT - 44),
86		 draw_animation_area('charge_bar_well_center', well_start + 16, SCREEN_HEIGHT - 44, well_size/2),
87		 draw_animation('charge_bar_well_right', well_start + well_size - 16, SCREEN_HEIGHT - 44),
88		 #draw_text('door_label','BOSS:', 40, SCREEN_HEIGHT - 40),#
89		 draw_animation('boss_angryface_heart_icon', 20, SCREEN_HEIGHT - 56),
90
91
92		 if(boss_hitpoints < 20,
93		   [draw_animation_area('charge_bar_left', bar_start, SCREEN_HEIGHT - 40, boss_hitpoints/4),
94		    draw_animation_area('charge_bar_right', bar_start + boss_hitpoints/2, SCREEN_HEIGHT - 40, 5 - boss_hitpoints/4, 0, boss_hitpoints/4, 5)],
95
96		[draw_animation_area('charge_bar_center', bar_start + 10, SCREEN_HEIGHT - 40, (boss_hitpoints)/2),
97		 draw_animation('charge_bar_left', bar_start, SCREEN_HEIGHT - 40),
98		 draw_animation('charge_bar_right', bar_start + boss_hitpoints, SCREEN_HEIGHT - 40),
99
100		])]
101
102	   where boss_hitpoints = object.vars.boss_hitpoints*bar_size
103	   	where bar_size = well_size - 2
104	    where well_size = 640
105		where bar_start = well_start + 4
106	   	where well_start = 90
107	 ),
108
109	 if(object.vars.powerup_time > 20,
110	   [draw_animation('charge_bar_left', 14, 90),
111		draw_animation('charge_bar_right', 14 + object.vars.powerup_time - 11, 90),
112	    draw_animation_area('charge_bar_center', 14 + 10, 90, (object.vars.powerup_time - 20)/2)
113	   ]
114	 )
115
116	])",
117animation: [
118
119	#
120	#
121	# Character and weapon icons
122	{
123		id: "frogatto_portrait",
124		image: "gui/hud.png",
125		rect: [1,36,20,55],
126		frames: 1,
127		duration: 6,
128	},
129	{
130		id: "frogatto_energyshot_portrait",
131		image: "gui/hud.png",
132		rect: [27,36,46,55],
133		frames: 1,
134		duration: 6,
135	},
136	{
137		id: "frogatto_firebreath_portrait",
138		image: "gui/hud.png",
139		rect: [53,36,72,55],
140		frames: 1,
141		duration: 6,
142	},
143	{
144		id: "frogatto_tongue_portrait",
145		image: "gui/hud.png",
146		rect: [79,36,98,55],
147		frames: 1,
148		duration: 6,
149	},
150	{
151		id: "frogatto_homingshot_portrait",
152		image: "gui/hud.png",
153		rect: [53,62,72,81],
154		frames: 1,
155		duration: 6,
156	},
157	{
158		id: "nene_portrait",
159		image: "gui/hud.png",
160		rect: [1,62,20,81],
161		frames: 1,
162		duration: 6,
163	},
164	{
165		id: "nene_flamethrower_portrait",
166		image: "gui/hud.png",
167		rect: [27,62,46,81],
168		frames: 1,
169		duration: 6,
170	},
171	{
172		id: "pato_portrait",
173		image: "gui/hud.png",
174		rect: [1,88,20,107],
175		frames: 1,
176		duration: 6,
177	},
178	{
179		id: "pato_glove_portrait",
180		image: "gui/hud.png",
181		rect: [27,88,46,107],
182		frames: 1,
183		duration: 6,
184	},
185	{
186		id: "gold_background",
187		image: "gui/hud.png",
188		rect: [1,1,58,11],
189		frames: 1,
190		duration: 100,
191	},
192	{
193		id: "small_heart_full",
194		image: "gui/hud.png",
195		rect: [72,17,82,28],
196		frames: 1,
197		duration: 100,
198	},
199	{
200		id: "small_heart_empty",
201		image: "gui/hud.png",
202		rect: [114,17,124,28],
203		frames: 1,
204		duration: 100,
205	},
206	{
207		id: "heart_full",
208		image: "gui/hud.png",
209		rect: [76,145,90,165],
210		frames: 1,
211		duration: 100,
212	},
213	{
214		id: "heart_half",
215		image: "gui/hud.png",
216		rect: [94,145,108,165],
217		frames: 1,
218		duration: 100,
219	},
220	{
221		id: "heart_empty",
222		image: "gui/hud.png",
223		rect: [112,145,126,165],
224		frames: 1,
225		duration: 100,
226	},
227	{
228		id: "bar_frame",
229		image: "gui/hud.png",
230		rect: [4,115,43,126],
231	},
232	{
233		id: "bar_element",
234		image: "gui/hud.png",
235		rect: [98,105,109,112],
236	},
237	{
238		id: "charge_bar_center",
239		image: "gui/progress-bar-center.png",
240		rect: [0,0,7,7],
241	},
242	{
243		id: "charge_bar_left",
244		image: "gui/progress-bar-endcaps.png",
245		rect: [3,0,7,6],
246	},
247	{
248		id: "charge_bar_right",
249		image: "gui/progress-bar-endcaps.png",
250		rect: [0,8,4,14],
251	},
252	{
253		id: "charge_bar_well_center",
254		image: "gui/progress-bar-well-center.png",
255		rect: [0,0,15,11],
256	},
257	{
258		id: "charge_bar_well_left",
259		image: "gui/progress-bar-well-endcaps.png",
260		rect: [0,0,15,11],
261	},
262	{
263		id: "charge_bar_well_right",
264		image: "gui/progress-bar-well-endcaps.png",
265		rect: [0,16,15,27],
266	},
267	{
268		id: "manabar_empty",
269		image: "gui/hud.png",
270		rect: [2,131,124,139],
271	},
272	{
273		id: "boss_angryface_heart_icon",
274		image: "gui/hud.png",
275		rect: [101,47,126,72],
276	},
277],
278}
279