-
Notifications
You must be signed in to change notification settings - Fork 1
/
lawofthewest.p8
839 lines (764 loc) · 44.5 KB
/
lawofthewest.p8
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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
pico-8 cartridge // http://www.pico-8.com
version 16
__lua__
-- law of the west
-- by vgebrev
function make_actor(state, position, velocity, face_left, update_box_fn, behaviour_fn)
local actor = {}
actor.animation = { length = 0.068, elapsed = 0}
actor.state = state
actor.position = position
actor.velocity = velocity
actor.acceleration = { x = 0, y = 0}
actor.death_clock = 2
actor.face_left = face_left
actor.box = update_box_fn(actor)
actor.update_box_fn = update_box_fn
actor.behaviour_fn = behaviour_fn
actor.projectile = make_projectile(actor)
return actor
end
function make_projectile(actor)
local projectile = {}
projectile.position = { x = actor.position.x + (actor.face_left and -10 or 10), y = actor.position.y + 12 }
projectile.velocity = { x = actor.face_left and -6 or 6, y = 0}
projectile.sprite = 18
projectile.fired = false
projectile.face_left = actor.face_left
projectile.box = update_projectile_box(projectile)
return projectile
end
function make_eagle(position, velocity)
local eagle = {}
eagle = make_actor("soar", position, velocity, true, update_eagle_box, behaviour_eagle)
eagle.elements = {
--head
{ states = alive_states, frame = 0, frame_step = 1, frame_count = 6, spr_offset = 48, position = { x = 0, y = 0 } },
--tail
{ states = alive_states, frame = 0, frame_step = 1, frame_count = 6, spr_offset = 54, position = { x = -8, y = 0 } },
}
return eagle
end
function make_innocent(position, shirt_color, legs_color)
local innocent = {}
innocent = make_actor("ground", position, { x = -1, y = 0 }, true, update_cowboy_box, behaviour_innocent)
innocent.elements = {
--head
{ states = alive_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 22, p = { { c1 = 8, c2 = 0 } }, position = { x = 0, y = 7 } },
--upright_torso
{ states = upright_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 21, p = { { c1 = 3, c2 = shirt_color } }, position = { x = 0, y = 14 } },
--upright_legs
{ states = upright_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 37, p = { { c1 = 12, c2 = legs_color } }, position = { x = 0, y = 22 } },
--crouch_torso
{ states = crouch_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 21, p = { { c1 = 3, c2 = shirt_color } }, position = { x = 0, y = 15 }, scale_height = 0.4 },
--crouch_legs
{ states = crouch_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 37, p = { { c1 = 12, c2 = legs_color } }, position = { x = 0, y = 18 }, scale_height = 0.4 },
--dead_hat
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 14, position = { x = 1, y = 1 } },
--dead_head
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 10, p = { { c1 = 8, c2 = 0 } }, position = { x = 1, y = 7 } },
--dead_torso
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 24, p = { { c1 = 3, c2 = shirt_color } }, position = { x = -5, y = 6 } },
--dead_legs
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 23, p = { { c1 = 12, c2 = legs_color } }, position = { x = -13, y = 6 } },
}
return innocent
end
function make_cowboy(position, velocity, face_left, shirt_color, legs_color, legs_sprite_offset, head_sprite_offset, behaviour_fn)
local cowboy = {}
cowboy = make_actor("ground", position, velocity, face_left, update_cowboy_box, behaviour_fn)
cowboy.elements = {
--hat
{ states = alive_states, frame = 0, frame_step = 0.5, frame_count = 2, spr_offset = 14, position = { x = 1, y = 1 } },
--head
{ states = alive_states, frame = 0, frame_step = 1, frame_count = 4, spr_offset = head_sprite_offset, p = { { c1 = 8, c2 = 0 } }, position = { x = 1, y = 7 } },
--upright_torso
{ states = upright_states, frame = 0, frame_step = 1, frame_count = 5, spr_offset = 5, p = { { c1 = 3, c2 = shirt_color } }, position = { x = 0, y = 14 } },
--upright_legs
{ states = upright_states, frame = 0, frame_step = 1, frame_count = 5, spr_offset = legs_sprite_offset, p = { { c1 = 12, c2 = legs_color }}, position = { x = 0, y = 22 } },
--crouch_torso
{ states = crouch_states, frame = 0, frame_step = 1, frame_count = 5, spr_offset = 5, p = { { c1 = 3, c2 = shirt_color } }, position = { x = 0, y = 15 }, scale_height = 0.4 },
--crouch_legs
{ states = crouch_states, frame = 0, frame_step = 1, frame_count = 5, spr_offset = legs_sprite_offset, p = { { c1 = 12, c2 = legs_color } }, position = { x = 0, y = 18 }, scale_height = 0.4 },
--dead_hat
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 14, position = { x = 1, y = 1 } },
--dead_head
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = head_sprite_offset, p = { { c1 = 8, c2 = 0 } }, position = { x = 1, y = 7 } },
--dead_torso
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 24, p = { { c1 = 3, c2 = shirt_color } }, position = { x = -5, y = 6 } },
--dead_legs
{ states = dead_states, frame = 0, frame_step = 0, frame_count = 1, spr_offset = 23, p = { { c1 = 12, c2 = legs_color } }, position = { x = -13, y = 6 } },
--gun
{ states = alive_states, frame = 0, frame_step = 0.2, frame_count = 2, spr_offset = 16, position = { x = 6, y = 13 } },
}
return cowboy;
end
function make_blood(projectile)
local blood={}
for i=0,32 do
local drop = {}
drop.position = { x = projectile.position.x + i % 4, y = projectile.position.y + flr(i / 4) }
drop.velocity = { x = (projectile.face_left and 1 or -1) * min(0, projectile.velocity.x / 4 - rnd(2)), y = 2 - rnd(6) }
drop.acceleration = { x = (projectile.face_left and 1 or -1) * -0.1, y = 0.5}
drop.life = 32 + flr(rnd(24))
drop.color = rnd(1) < 0.9 and 8 or 14
add(blood, drop)
end
return blood
end
function make_ground()
local column = {}
for grass=1,flr(rnd(4))+1 do
add(column, 11)
end
for grass_shade=1,flr(rnd(3))+1 do
add(column, 3)
end
for earth=1,14 do
add(column, (flr(rnd(2)) + 1)*2)
end
return column
end
function init_ground()
ground = {}
ground.y = 112
ground.columns = {}
for i=1,128 do
add(ground.columns, make_ground())
end
end
function make_cloud()
local cloud = {}
local puff_count = flr(rnd(3)) + 3
local base_radius = flr(rnd(5)) + 10
cloud.velocity = { x = rnd(0.4) + 0.1, y = 0}
cloud.position = { x = -1 * (puff_count + 1) * base_radius, y = flr(rnd(40)) }
cloud.puffs = {}
for i=1,puff_count do
add(cloud.puffs, { x = i * base_radius - 3, y = 0, radius = base_radius * (1 - rnd(0.3))})
end
return cloud
end
function init_clouds()
clouds = {}
add(clouds, make_cloud())
add(clouds, make_cloud())
end
function set_states(states)
local result = {}
for state in all(states) do
result[state] = true
end
return result
end
function init_states()
alive_states = set_states({ "ground", "jump", "dying", "crouch", "soar", "divebomb" })
upright_states = set_states({ "ground", "jump" })
crouch_states = set_states({ "dying", "crouch" })
dead_states = set_states({ "dead" })
end
function init_game()
game.score = 0
game.loss_reason = nil
game.loss_cooloff = { length = 1.5, elapsed = 0 }
timer = { elapsed = 0, last = time() }
bloods = {}
actors = {
make_cowboy({ x = 12, y = 82 }, { x = 0, y = 0 }, false, 3, 12, 0, 10),
make_cowboy({ x = 130, y = 82 }, { x = -2.25, y = 0 }, true, 5, 3, 32, 26, behaviour_bandit),
make_innocent({ x = 160, y = 82 }, 5, 3),
make_eagle({ x = 256, y = 16 }, { x = -3, y = 0 })
}
hero = actors[1]
bandit = actors[2]
innocent = actors[3]
eagle = actors[4]
end
function _init()
game = { state = "welcome" }
init_states()
init_ground()
init_clouds()
init_game()
music(0)
end
function jump_cowboy(cowboy)
cowboy.velocity.y = -13
cowboy.acceleration.y = 2
cowboy.state = "jump"
sfx(25)
end
function kill_cowboy(cowboy)
if (cowboy.state == "dying" or cowboy.state == "dead") then return end
cowboy.velocity = { x = cowboy.velocity.x * 0.75, y = cowboy.state == "jump" and 2 or 0 }
cowboy.acceleration = { x = 0, y = cowboy.state == "jump" and 2 or 0 }
cowboy.position.y = cowboy.state == "jump" and min(cowboy.position.y, ground.y - 21) or ground.y - 21
cowboy.state = "dying"
cowboy.death_clock = 2
sfx(26)
end
function check_collision(box1, box2)
if (box1.x < box2.x + box2.w
and box1.x + box1.w > box2.x
and box1.y < box2.y + box2.h
and box1.y + box1.h > box2.y) then
return true
end
return false
end
function check_projectile_death(projectile, cowboy)
if (projectile.fired and check_collision(projectile.box, cowboy.box)) then
kill_cowboy(cowboy)
add(bloods, make_blood(projectile))
projectile.position.x = projectile.face_left and 0 or 127
return true
end
return false
end
function vector_magnitude(v)
return sqrt(v.x * v.x + v.y * v.y)
end
function vector_add(v1, v2)
return { x = v1.x + v2.x, y = v1.y + v2.y }
end
function check_melee_death()
if (bandit.state == "dying" or bandit.state == "dead" or not check_collision(bandit.box, hero.box)) then return false end
if (vector_magnitude(hero.velocity) <= vector_magnitude(bandit.velocity)) then
kill_cowboy(hero)
return true
else
kill_cowboy(bandit)
game.score +=1
return false
end
end
function check_eagle_death()
if (not check_collision(eagle.box, hero.box)) then return false end
kill_cowboy(hero)
add(bloods, make_blood(eagle.projectile))
return true
end
function update_game_over()
if (hero.state == "dead" or innocent.state == "dead") then
if (bandit.state == "dying") then expire_actor(bandit) end
if (hero.state == "dying") then expire_actor(hero) end
if (innocent.state == "dying") then expire_actor(innocent) end
game.state = "loss"
end
end
function update_blood()
for blood in all(bloods) do
for drop in all(blood) do
if (drop.life > 0) then
drop.life -= 1
move_object(drop)
drop.position.y = min(ground.y, drop.position.y)
if (drop.position.y == ground.y) then
drop.velocity = { x = game.state == "play" and -1 or 0, y = 0 }
drop.acceleration = { x = 0, y = 0 }
end
else
del(blood, drop)
end
end
if (#blood == 0) then
del(bloods, blood)
end
end
end
function update_input()
if (hero.state == "dead" or hero.state == "dying") then return end
if (btnp(2) and hero.state == "ground") then
jump_cowboy(hero)
end
if (btn(3) and hero.state != "jump") then
hero.position.y = ground.y - 21
hero.state = "crouch"
elseif (hero.state == "crouch") then
hero.position.y = ground.y - 30
hero.state = "ground"
end
if (btnp(5) and not hero.projectile.fired) then
hero.projectile.position.y = hero.position.y + 12
hero.projectile.fired = true
sfx(24)
end
end
function update_instructions_input()
if (game.loss_cooloff.elapsed < game.loss_cooloff.length) then
game.loss_cooloff.elapsed += timer.elapsed
return
end
if (btnp() ~= 0) then
game.state = "play"
init_game()
end
end
function behaviour_bandit(bandit)
if (bandit.state == "dead" or bandit.state == "dying") then return end
local dx = bandit.position.x - hero.position.x
if (not bandit.projectile.fired and hero.state ~= "jump" and alive_states[hero.state]
and dx >= 56 and bandit.position.x <= 127 and eagle.position.x > bandit.position.x and rnd(1) < 0.05) then
bandit.projectile = make_projectile(bandit)
bandit.projectile.fired = true
sfx(24)
end
dx = bandit.position.x - hero.projectile.position.x
if (bandit.state == "ground" and hero.projectile.fired
and dx <= 32 and dx > 0 and hero.projectile.position.y >= bandit.position.y + 8 and rnd(1) < 0.125) then
jump_cowboy(bandit)
end
end
function behaviour_innocent(innocent)
if (rnd(1) < 0.05) then innocent.face_left = not innocent.face_left end
end
function behaviour_eagle(eagle)
eagle.projectile.position = { x = eagle.position.x, y = eagle.position.y + eagle.box.h }
if (eagle.state == "divebomb") then
local target_height = ground.y - 27
eagle.acceleration.y = max(0, eagle.acceleration.y - 0.01)
if (eagle.position.y > target_height or eagle.position.y < 0) then
eagle.acceleration.y = 0
eagle.velocity.y = 0
eagle.position.y = target_height
end
return
end
if (eagle.position.x <= 96 and rnd(1) < 0.2) then
eagle.state = "divebomb"
eagle.acceleration.y = 0.5
sfx(27)
end
end
function reset_actor(actor, state, velocity, position)
if (actor.box.x + actor.box.w < -8) then
actor.position = position
actor.velocity = velocity
actor.acceleration = { x = 0, y = 0 }
actor.state = state
end
end
function reset_actors_out_of_bounds()
reset_actor(bandit, "ground", { x = -2 - rnd(0.5), y = 0 }, { x = 130 + flr(rnd(96)), y = ground.y - 30 })
reset_actor(innocent, "ground", { x = -1, y = 0}, { x = 130 + flr(rnd(256)), y = ground.y - 30})
reset_actor(eagle, "soar", { x = -3, y = 0 }, { x = 384 + flr(rnd(256)), y = flr(rnd(28)) + 1})
end
function update_timer()
timer.elapsed = (time() - timer.last)
timer.last = time()
end
function update_frame(animated_element)
return (animated_element.frame + animated_element.frame_step) % animated_element.frame_count
end
function update_eagle_box(eagle)
local box = {}
box = { x = eagle.position.x, y = eagle.position.y, w = 12, h = 8 }
return box
end
function update_cowboy_box(cowboy)
local box = {}
box = { x = cowboy.position.x, y = cowboy.position.y + 4 }
if (cowboy.state == "ground" or cowboy.state == "jump") then
box.w = 8
box.h = 26
elseif (cowboy.state == "crouch" or cowboy.state == "dying") then
box.w = 8
box.h = 17
elseif (cowboy.state == "dead") then
box.w = 22
box.h = 9
end
return box
end
function expire_actor(actor)
actor.state = "dead"
actor.position.y = ground.y - 13
actor.velocity = { x = -1, y = 0 }
actor.acceleration = { x = 0, y = 0 }
end
function move_object(object)
if (object.velocity) then
object.position = vector_add(object.position, object.velocity)
end
if (object.acceleration) then
object.velocity = vector_add(object.velocity, object.acceleration)
end
end
function update_actor(actor)
actor.animation.elapsed += timer.elapsed
if (actor.animation.elapsed >= actor.animation.length) then
for k,v in pairs(actor.elements) do
actor.elements[k].frame = update_frame(v)
end
if (actor.state == "dying") then
actor.death_clock -= 1
if (actor.death_clock <= 0) then
expire_actor(actor)
end
end
actor.animation.elapsed = 0
end
actor.box = actor.update_box_fn(actor)
move_object(actor)
if (actor.position.y + actor.box.h >= ground.y) then
actor.position.y = ground.y - 30
if (actor.state == "jump") then
actor.velocity.y = 0
actor.acceleration.y = 0
actor.state = "ground"
end
end
if (update_projectile(actor.projectile)) then
actor.projectile = make_projectile(actor)
end
if (actor.behaviour_fn) then
actor.behaviour_fn(actor)
end
end
function update_projectile_box(projectile)
local box = {}
box = { x = projectile.position.x + 1, y = projectile.position.y + 2, w = 6, h = 4 }
return box
end
function update_projectile(projectile)
if (not projectile.fired) then return end
move_object(projectile)
projectile.box = update_projectile_box(projectile)
if (projectile.position.x > 127 or projectile.position.x < 0) then
return true
end
return false
end
function update_ground()
for i=1,#ground.columns do
ground.columns[i] = ground.columns[i+1]
end
add(ground.columns, make_ground())
end
function update_clouds()
for cloud in all(clouds) do
cloud.position.x += cloud.velocity.x
if (cloud.position.x > 135) then
del(clouds, cloud)
add(clouds, make_cloud())
end
end
end
function update_death()
if (check_projectile_death(hero.projectile, bandit) and not dead_states[bandit.state]) then game.score += 1 end
if (check_projectile_death(hero.projectile, innocent) and not game.loss_reason) then game.loss_reason = "you killed an innocent" end
if (check_projectile_death(bandit.projectile, hero) or check_melee_death() or check_eagle_death() and not game.loss_reason) then game.loss_reason = "you're dead" end
end
function _update()
update_timer()
if (game.state == "play") then
for i=1,#actors do
update_actor(actors[i])
end
update_input()
update_death()
update_game_over()
update_ground()
reset_actors_out_of_bounds()
else
update_instructions_input()
end
update_blood()
if (game.state ~= "loss") then
update_clouds()
end
end
function draw_frame(animated_element, x, y, scale_height, flip_x)
if (not animated_element) then return end
if (animated_element.p) then
for c in all(animated_element.p) do
pal(c.c1, c.c2)
end
end
local sprite_x = animated_element.spr_offset % 16
local sprite_y = flr(animated_element.spr_offset / 16);
sspr(flr(animated_element.frame + sprite_x) * 8, sprite_y * 8, 8, 8, x, y, 8, 8 * scale_height, flip_x)
pal()
end
function draw_actor(actor)
local x = actor.position.x
local y = actor.position.y
draw_projectile(actor.projectile)
for element in all(actor.elements) do
if (element.states[actor.state]) then
draw_frame(element, x + (actor.face_left and -1 or 1) * element.position.x, y + element.position.y, element.scale_height or 1, actor.face_left)
end
end
end
function draw_actor_box(actor)
rect(actor.box.x, actor.box.y, actor.box.x + actor.box.w, actor.box.y + actor.box.h, 0)
pset(actor.position.x, actor.position.y, 6)
end
function draw_projectile(projectile)
if (not projectile.fired) then return end
local box = projectile.box;
spr(projectile.sprite, flr(projectile.position.x), flr(projectile.position.y), 1, 1, projectile.face_left)
end
function draw_ground()
for x=1,#ground.columns do
local column = ground.columns[x]
for y=1,#column do
local color = column[y]
pset(x - 1, ground.y + y - 1, color)
end
end
end
function draw_clouds()
for cloud in all(clouds) do
for puff in all(cloud.puffs) do
circfill(flr(cloud.position.x + puff.x), flr(cloud.position.y + puff.y), puff.radius, 6)
end
for puff in all(cloud.puffs) do
circfill(flr(cloud.position.x + puff.x), flr(cloud.position.y + puff.y), puff.radius - 2, 7)
end
end
end
function draw_blood()
for blood in all(bloods) do
for drop in all(blood) do
pset(drop.position.x, drop.position.y, drop.color)
end
end
end
function draw_instructions()
local cooloff = ceil((game.loss_cooloff.length - game.loss_cooloff.elapsed) / 0.5)
local text = game.state == "welcome" and
{ "the law of the west", "kill or avoid your enemies", "spare the innocent", "", cooloff > 0 and "get ready "..cooloff or "press a button to start" }
or { "game over", game.loss_reason, "", cooloff > 0 and "get ready "..cooloff or "press a button to restart" }
for i=1,#text do
print(text[i], 64 - (#text[i] * 4) / 2, 40 + i * 8, i == 1 and 2 or 7)
end
if (game.state == "welcome") then print("⬆️jump ⬇️duck ❎shoot", 22, 88, 6) end
end
function draw_score()
print("bandit body count: "..game.score, 1, 1, 2)
end
function _draw()
cls(1)
draw_ground()
draw_clouds()
if (game.state == "play" or game.state == "loss") then
draw_actor(innocent)
draw_actor(bandit)
draw_actor(hero)
draw_actor(eagle)
draw_blood()
draw_score()
end
if (game.state ~= "play") then
draw_instructions()
end
end
__gfx__
00ccc00000ccc00000ccc00000ccc00000ccc0000000333000003330000033300000333000003330044444440444444000000000000000000000000000000000
00ccc00000ccc00000ccc00000ccc00000ccc000000ff330000ff33000fff33000fff330000ff33044ff550044ff550404444444044444400000000000000000
000cc000000cc00000c0c00000c0cc0000ccc000000ff330000ff33000ff333000ff3330000ff33000fffff000fffff044ff550004ff55040000000000000000
000cc000000c0c0000c00c0000c00cc0000cc000000f330000f333000f03330f0f03330f00f3330000fffff000fffff000fffff040fffff00000000000000000
5cccc00000cccc0000c000c0ccc000c0000c0c000003f3f000ff33ff00f333f00f0333f00f0333ff00ff990000ff990000fffff000fffff00440440000000000
50cc00000c0500000c000c00500000c005cc0c0000033fff0003f30000f333000f03330000f3330000ff9e0000ff9e0000ff990000ff99000444444004404400
000c00000505000050005000500000c050000c0000333300003333000033330000333300003f3300000f9000000f900000ff9e0000ff9e000444444004444440
000550000550000050000500000000550000055000333000003330000033300000333000003330000000000000000000000f9000000f90000000000004444440
0000000005000000000000000000000000000000f033333f00440400000000000000000000000000044444400444444400000000000000000000000000000000
0500000000555005000000000000000000000000fff333ff4044440400000000000000000000000004ffcd0444ffcd0004444440044444440000000000000000
00555005005d55550050555000000000000000000ff333ff0444444f00000000000000000000000040fffff000fffff044ffcd0404ffcd000000000000000000
005d555504555000006d666d000000000000000000333330f05c5c0f000000cc3300000000000000088888800888888080fffff040fffff00000000000000000
0455500004450000005d555d000000000000000000333330f0ffff0f5c00cccc83333ff000000000808888808088888008888880888888800000000000000000
044500004440000000505550000000000000000000033300f0feef0f55cccc8e3333fff30000000000f8888800f8888800888880008888800000000000000000
444000004400000000000000000000000000000000033300f0ffff0f85c8e888883f833300000000000f8888000f888800f8888800f888880000000000000000
440000000000000000000000000000000000000000033300f00ff00f000000008888ef33000000000000088000000880000f8888000f88880000000000000000
00ccc00000ccc00000ccc00000ccc00000ccc000000ccc0000000000000000000000000000000000000000000000000000000000000000000000000000000000
00ccc00000ccc00000ccc00000ccc00000ccc000000ccc0000000000000000000000000000000000000000000000000000000000000000000000000000000000
000cc000000cc000000cc000000cc000000cc000000c0c0000000000000000000000000000000000000000000000000000000000000000000000000000000000
000cc000000ccc0000c0c00000c0cc005c0c0c0000c00c0000000000000000000000000000000000000000000000000000000000000000000000000000000000
5ccc0c000005c00000c00c0000c000c050c00c0000c000c000000000000000000000000000000000000000000000000000000000000000000000000000000000
50000c00005c00000c000c000c0000c0000000c00c0000c000000000000000000000000000000000000000000000000000000000000000000000000000000000
0000c00000c0000005000550500000c5000000c00c0000c000000000000000000000000000000000000000000000000000000000000000000000000000000000
00005500005500000050000050000050000000555500005500000000000000000000000000000000000000000000000000000000000000000000000000000000
44400660000006600000066000000660000006600000066000000006000000000000000000000000000000000000000000000000000000000000000000000000
44440650444006500000065000000650000006504440065000006440000000060000000000000000000000000000000600000000000000000000000000000000
42224699422246992222469922224699222246994222469900000444000000240000060400000002000006040000002400000000000000000000000000000000
44222409444224094422240922222409442224094442240900000044000064440000622200006222000062220000644400000000000000000000000000000000
42222200442222004422220044422200442222004422220000006224000064440000024400000624000002440000644400000000000000000000000000000000
22220000422200004222400044224000422240004222000000000622000006240000444400000004000044440000062400000000000000000000000000000000
09090000090900000909000049494000090900000909000000000000000000000000644400000044000064440000000000000000000000000000000000000000
00909000009090000909000049090000009090000090900000000000000000000000060000000664000006000000000000000000000000000000000000000000
__label__
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
12221222122112211222122211111222112212211212111111221122121212211222111111111222111111111111111111111111111111111111111111111111
12121212121212121121112111111212121212121212111112111212121212121121112111111112111111111111111111111111111111111111111111111111
12211222121212121121112111111221121212121222111112111212121212121121111111111122111111111111111111111111111111111111111111111111
12121212121212121121112111111212121212121112111112111212121212121121112111111112111111111111111111111111111111111111111111111111
12221212121212221222112111111222122112221222111111221221112212121121111111111222111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111116666666111116666666111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111666666666661666666666661116666666111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111116666777776666666777776666666666666661111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111666677777777766677777777766666777776666111666661111111111111111111
11111111111111111111111111111111111111111111111111111111111111667777777777777777777777777677777777766666666666611111111111111111
11111111111111111111111111111111111111111111111111111111111116677777777777777777777777777777777777776666777776661111111111111111
11111111111111111111111111111111111111111111111111111111111166677777777777777777777777777777777777777667777777666111111111111111
11111111111111111111111111111111111111111111111111111111111166777777777777777777777777777777777777777777777777766611111111111111
11111111111111111111111111111111111111111111111111111111111666777777777777777777777777777777777777777777777777776611111111111111
61111111111111111111111111111111111111111111111111111111111667777777777777777777777777777777777777777777777777777661111111111111
66111111111111111111111111111111111111111111111111111111111667777777777777777777777777777777777777777777777777777661111111111111
66611111111111111111111111111111111111111111111111111111111667777777777777777777777777777777777777777777777777777661111111111111
76611111111111111111111111111111111111111111111111111111111667777777777777777777777777777777777777777777777777777661111111111111
76611111111111111111111111111111111111111111111111111111111667777777777777777777777777777777777777777777777777777661111111111111
77661111111111111111111111111111111111111111111111111111111666777777777777777777777777777777777777777777777777776611111111111111
77661111111111111111111111111111111111111111111111111111111166777777777777777777777777777777777777777777777777766611111111111111
77661111111111111111111111111111111111111111111111111111111166677777777777777777777777777777777777777667777777666111111111111111
77661111111111111111111111111111111111111111111111111111111116677777777777777777777777777777777777776666777776661111111111111111
77661111111111111111111111111111111111111111111111111111111111667777777777777777777777777677777777766666666666611111111111111111
77661111111111111111111111111111111111111111111111111111111111666677777777766677777777766666777776666111666661111111111111111111
77661111111111111111111111111111111111111111111111111111111111116666777776666666777776666666666666661111111111111111111111111111
76611111111111111111111111111111111111111111111111111111111111111666666666661666666666661116666666111111111111111111111111111111
76611111111111111111111111111111111111111111111111111111111111111116666666111116666666111111111111111111111111111111111111111111
66611111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
66111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
61111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111441441111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111444444111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111114444444111111111111111111111111111111111111111111111111111111118e1111111111111111111111111111111111111111111111111
111111111111144ff551111111111111111111111111111111111111111111111111111111118111111111111111111111111111111111111111111111111111
111111111111111fffff111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111fffff1111111111111111111111111111111111111111111111111111111118e1111111111111111111111111111111111111111111111111
111111111111111ff9911111111111111111111111111111111111111111111111111111111118e8111111111111111111111111111111111111111111111111
111111111111111ff9e1111111111111111111111111111111111111111111111111111111111818111111111111111111111111111111111111111111111111
1111111111111111f915111111111111111111111111111111111111111111111111111111118118111111111111111111111111111111111111111111111111
11111111111111113331555115111111111155515111111111111111111111111111111111111814414411111111111111111111111111111111111111111111
11111111111111fff3315d5555111111111d666d6111111111111111111111111111111111118184444411111111111111111111111111111111111111111111
11111111111111ff3334555111111111111d555d511111111111111111111111111111111111e188444411111111111111111111111111111111111111111111
1111111111111f133314451111111111111155515111111111111111111111111111111111118488cff411111111111111111111111111111111111111111111
1111111111111f1333444111111111111111111111111111111111111111111111111111111111fffff141111111111111111111111111111111111111111111
1111111111111f133344111111111111111111111111111111111111111111111111111111111100000011111111111111111111111111111111111111111111
11111111111111333311111111111111111111111111111111111111111111111111111111111800000101111111111111111111111111111111111111111111
1111111111111133311111111111111111111111111111111111111111111111111111111111108000f111111111111111111111111111111111111111111111
11111111111111ccc1111111111111111111111111111111111111111111111111111111111180500f1111111111111111111111111111111111111111111111
11111111111111ccc111111111111111111111111111111111111111111111111111111151155500111111111111111111111111111111111111111111111111
11111111111111c1cc1111111111111111111111111111111111111111111111111111115555d5155fff11111111111111111111111111111111111111111111
11111111111111c11cc11111111111111111111111111111111111111111111111111111111555415551f1111111111111111111111111111111111111111111
111111111111ccc111c1111111111111111111111111111111111111111111111111111111115441555511111111111111111111111111111111111111111111
111111111111511111c1111111111111111111111111111111111111111111111111111111111444133311111111111111111111111111111111111111111111
111111111111511111c1111111111111111111111111111111111111111111111111111111111144331311111111111111111111111111111111111111111111
11111111111111111155111111111111111111111111111111111111111111111111111111111153111115111111111111111111111111111111111111111111
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
3bbbbb3bb33b33bb3bb3bb3bbb3b3bbbb3bbb3bbbbbbbbbbbbb3bb3bb3bbbbbbbbbbbbbbbbbbbb3bbbbb3bbbb3bbbbbbbbb3bbbb3bbbb3bbbbbbbb3bb33bb3bb
3bbb334bb22333b34bb3bb4bb33b3bbbb33bb3bbb3bb3bbbb3b4bb4bb333bbbbb3bb3bbb33b3334bb3bb3bbbb33b3bbbb3b4bbb343bbb3b3bb3bbb3b334bb3b3
23bb334bb24333b22bb23b2b32333bbb3333b3b3b2b32bb333343343b333b33b323b33b333b3322332b33b3b33332b3332b43b3423333333b333bb3b34433232
23332343322324322332434334232333323434323433433334442323322332433433323343333242343223333233233334343344423324233223334332233234
23332222344424324324232432434343342434222233233424424344344222233233444442342224323423332243233424242242422344444423234224234242
44334242244224344324434422222323242224422232442442224222344224444222424424422422443442244442444242224224222244442442432422442224
42424422242442224242222244424222424244442444222442224422244222444422424442242224424224224444242442224422422444242244224224242444
22444422444242442422224224424424224222222244442222422244242244244244422224222244422244442424422224442442244424444242422442244222
44242242222424242422242244242222224444224442444424222424422244422222442242422222244444442442442422422224422444424442244424244224
24224242424242422444444442444444424442222224444242242242244442244444244242422222424444442444424242444244444224424244222444424242
24224442422444224242244222444442244444444244424442422422442424424242444224244424422244244242224444242424224422244424422444444222
44222442422424222424224222244444244444442424222244424444444442444224224444222422442442422244444424242244224424442242444222242244
22242424224242222424242224442442222224424242422444222242224424244244422244444242224224244224222422442224422242224424444224242242
24244244222222444444444222424244222244444222244224224422244242424244222224424424424444222242244422242244222424224444422242242224
24244244424224222442442244224442424424444424424422242244422422442424244442424224242422424222242422242222244242222224442444242224
__sfx__
010a00000f050000000000000000140500000000000000000f0500000000000000001405000000000000000015050000000070000000160500000000000000000f05000000000000000016050000000000000000
010a00000000000000000000000000000000002004000000270500000020040000002405000000270400000000000000001f0400000027050000001f040000002205000000270400000000000000000000000000
010a00001b0500000000000000001c050000000000000000000000000000000000001b0500000000000000001b0500000000000000001c050000000000000000000000000000000000001b050000000000000000
010a00000000000000270500000000000000002004000000230400000028050000000000000000270400000000000000002705000000000000000020040000002304000000280500000000000000002704000000
010a00001405000000200500000023040000002c030000001405000000200500000023040000002c030080001405008000200500b00023040080002c030000001405000000200500000023040000002c03000000
010a00001705000000000000000017050000000000000000170500000000000000001705000000000000000018050000000000000000180500000000000000001805000000000000000018050000000000000000
010a00001a0300000000000000001a0300000000000000001a0300000000000000001a0300000000000000001b0300000000000000001b0300000000000000001b0300000000000000001b030000000000000000
010a00002c0400000000000000002c0400000000000000002c0400000000000000002c040240002c0300000000000000002703000000290400000024030000002704000000290300000000000000002004000000
010a00001c0500000000000000001c0500000000000000001b0500000000000000001b0500000000000000001b050000000000000000190500000000000000001805000000000000000015050000000000000000
010a0000000000000022040000002305000000200400000022050000002404000000000000000020050000002405000000200400000022050000000000000000200500000000000000002c050000000000000000
010a000000000000002204023000230502000020040220002205024000240400000000000200002004024000240502000020040220002205000000000002000020050000000000000000000002c0000000000000
010a0000160500000000000000000f050000000000000000160500000000000000000f050000000000000000160500000000000000000f050000000000000000160500000000000000000f050000000000000000
010a000000000000002b0500000033040000002b050000002e04000000320500000000000000002b0500000031040000002b050000002e040000003005000000000000000027040000002e040000002705000000
010a0000140500000000000000000f050000000000000000140500000000000000000f050000000000000000140500000000000000000f0500000000000000001405000000000000000015050000000000000000
010a0000000000000024050000002c04000000240500000027040000002905000000000000000024050000002c040000002405000000270400000029050000000000000000240500000029040000000000000000
010a0000000000000027050000002b04000000220500000025040000002905000000000000000027050000002b040000002205000000250400000029050000000000000000250500000029040000000000000000
010a0000140500000000000000000f050000000000000000140500000000000000000f05000000000000000014050000000000000000140500000000000000001305000000000000000012050000000000000000
010a0000000000000024050000002c04000000240500000027040000002905000000000000000024050000002c0400000000000000002c0400000000000000002b0300000000000000002a030000000000000000
010a00001105000000000000000011050000000000000000150500000000000000001505000000000000000016040000000000000000160400000000000000001603000000000000000016030000000000000000
010a000000000000001d05000000210500000024040000002904000000240300000021040000001d0500000000000000001d05000000220400000025040000002903000000000000000025030000000000000000
010a00000e0500000000000000000e0500000000000000000f05000000000000000013040000000000000000140400000000000000000f0300000000000000001405000000000000000000000000000000000000
010a000024050000000000000000000000000024050000000000000000220400000000000000001b0400000000000000002005000000240400000027040000002c05000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0110000024625186010c6010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
0101000012124111211012110121101210f1210f1210f1210f1210f1210f1210f1211012110121111211112112121131211512118121191211b1211e12120121221212412126121281212a1212c1212d1212f121
01090000180531503111011000000c053000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
01030000345543b5513a5513a5513a55139541385413854137541365313453133531315312f5212d5212c52129521275212552123521205211d51118511135110e51109511055110451104511035110351500500
__music__
00 00014344
00 00014344
00 02034344
00 04424344
00 05060744
00 08094344
00 05060744
00 080a4344
00 0b0c4344
00 0d0e4344
00 0b0f4344
00 0d0e4344
00 0b0c4344
00 10114344
00 12134344
02 14154344