-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathggj.p8
1347 lines (1242 loc) · 53.8 KB
/
ggj.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
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
pico-8 cartridge // http://www.pico-8.com
version 27
__lua__
-- init data
animations = {
bob = {
curr = 0,
final = 30,
active = false
},
title_prompt = {
curr = 0,
final = 35,
threshold = 30,
active = false
},
p = {
curr = 0,
final = 15,
dir = 0,
-- 0 is neutral
-- 1 is left
-- 2 is right
-- 3 is up
-- 4 is down
active = false
},
shake = {
x = 0,
y = 0,
strength = 0,
max_strength = 0.4,
fade_factor = 0.7
},
transition = {
final = 440,
curr = 0,
draw_step = 0.14,
step = 6,
r = 160
},
transition_end = {
final = 128,
curr = -30,
step = 3
}
}
p = {
x = 975,
y = 30,
speed = 2,
width=16,
height=32,
interact_rad = 300,
exp = 0,
prompt_final = false
}
npcs = {
{ -- woman
active = false,
battle = true,
x = 473,
y = 32,
width = 16,
height = 32,
sprite = 69,
v_offset = 5,
lines = {
{"* you politely greet the", "beautiful lady. *"},
{"please join me for tea!"}
},
win_lines = {
{"do i know a", "dominique bretodeau?"}, {"c'est moi!"}, {"* you politely thank her", "and leave *"}
},
lose_lines = {
{"* you are wooed by the woman."}, {"you forgot to ask her your", "question. *"}
}
},
{ -- dominique
active = false,
battle = true,
x = 0,
y = 500,
width = 16,
height = 32,
sprite = 65,
v_offset = 5,
lines = {
{"* you know in your heart", "that this is dominique. *"}
},
win_lines = {
{"* you approach the old man *"}
},
lose_lines = {
{"* you are too nervous", "to approach. *"}
}
},
{ -- young man
active = false,
battle = true,
x = 602,
y = 68,
width = 16,
height = 32,
sprite = 77,
v_offset = 5,
lines = {
{"* you politely greet the", "young man. *"},
{"what do you need?"}
},
win_lines = {
{"you are looking for a", "dominique bretodeau?"},
{"c'est moi!"},
{"* you know he is too young", "to be the person you are", "looking for *"},
{"* you thank him anyways *"}
},
lose_lines = {
{"sorry, i'm not interested."}
}
},
{ -- neighbor
active = false,
battle = false,
x = 0, -- to be 911
y = 500, -- to be 190
width = 16,
height = 32,
sprite = 67,
v_offset = 5,
lines = {
{"i heard you were looking", "for the boy who used to live", "in your house."},
{"his name is not dominique", "bredoteau!"},
{"instead, his name is", "dominique bretodeau!"},
{" * you are rejuvinated and", "more determined than ever. *"}
},
win_lines = {
},
lose_lines = {
}
},
{ -- casket
active = false,
battle = true,
x = 41,
y = 73,
width = 16,
height = 32,
sprite = 1,
v_offset = 5,
lines = {
{"* you slowly approach the", "casket. *"},
{"* a feeling of dread", "overwhelms you. *"}
},
win_lines = {
{"* you inspect the casket", "more closely. *"},
{"\"dominique bredoteau.\""},
{"* you bow your head and", "step back. *"}
},
lose_lines = {
{"* you cannot bring yourself", "to look at the casket. *"}
}
}
}
objects = {
{
x = 648,
y = 7,
width = 2,
height = 4,
sprite = 206
},
{
x = 768,
y = 7,
width = 2,
height = 4,
sprite = 206
},
{
x = 648,
y = 215,
width = 2,
height = 4,
sprite = 206
},
{
x = 768,
y = 215,
width = 2,
height = 4,
sprite = 206
},
{
x = 224,
y = 215,
width = 2,
height = 4,
sprite = 206
},
{
x = 104, -- has a problem
y = 215,
width = 2,
height = 4,
sprite = 206
},
{
x = 104,
y = 7,
width = 2,
height = 4,
sprite = 206
},
{ -- flowers
x = 27,
y = 152,
width = 2,
height = 4,
sprite = 141
},
{
x = 51,
y = 168,
width = 2,
height = 4,
sprite = 141
},
{
x = 51,
y = 208,
width = 2,
height = 4,
sprite = 141
},
{
x = 19,
y = 192,
width = 2,
height = 4,
sprite = 141
},
{
x = 19,
y = 32,
width = 2,
height = 4,
sprite = 141
},
{
x = 51,
y = 24,
width = 2,
height = 4,
sprite = 141
},
{
x = 396,
y = 215,
width = 4,
height = 2,
sprite = 35
},
{
x = 588,
y = 40,
width = 4,
height = 2,
sprite = 35
}
}
battle = {
p = {
sprite = 252,
x = 64,
y = 64,
w = 8,
h = 8,
speed = 1.75,
boost_speed = 5,
boost_duration = 2,
boost_cooldown = 0,
boost_cooldown_max = 10,
boost = 0
},
pickups = {
--[[
{
sprite = 220,
x = 16,
y = 16,
w = 8,
h = 8,
active = true
},
{
sprite = 220,
x = 100,
y = 100,
w = 8,
h = 8,
active = true
}--]]
},
enemies = {},
enemy_max = 50,
enemy_min_speed = 2,
enemy_speed_range = 3,
enemy_sprite = 237,
enemy_spawn_chance = 0.2,
enemy_ttl = 150,
collected = 0,
health = 3,
iframes = 10,
invincibility = 0,
win = false
}
cam = {
x = 0,
y = 0
}
dialog = {
active_npc = {},
lines = {},
curr = 1,
battle = false
}
return_prompt = {
{"you have given up on your", "journey to return the box"},
{"as none of the dominique", "bredoteaus you have found", "are the one you seek."},
{"maybe your neighbor", "can console you..."}
}
intro_text = {
{ 12, "bonjour, amelie!", 30},
{ 6, "it is the morning of august 31, 1997", 3},
{ 6, "you are shocked to see on tv", 3},
{ 12, "that lady di has died.", 3},
{ 6, "in your shock, you drop your", 3},
{ 6, "purfume bottle, knocking a", 3},
{ 12, "baseboard off of the wall.", 3},
{ 6, "after further inspection, you", 3},
{ 12, "find an old memento box!", 3},
{ 12, "dominique bredoteau?", 3},
{ 6, "you shall find him and return", 3},
{ 6, "his box!", 3}
}
ending_text = {
{ 6, "you hand the box of mementos", 3},
{ 6, "to dominique bretodeau", 3},
{ 6, "and his eyes fill with tears", 3},
{ 6, "as he looks through", 3},
{ 6, "his long lost", 3},
{ 12, "childhood memories.", 3},
{ 6, "the box has found its way home,", 3},
{ 6, "and you are fulfilled,", 3},
{ 6, "so much so that", 3},
{ 6, "your life's passion is", 3},
{ 12, "now to do good for others.", 3},
{ 6, "the end", 3}
}
function _update_empty()
_x = 0
end
function _init()
music(17)
_update = _update_title
_draw = _draw_title
base = 110
base2 = 110
palt(0, false)
palt(11, true)
end
-->8
-- update functions
function _update_title()
if btnp(🅾️) then
sfx(45)
_update = _update_intro
_draw = _draw_intro
end
if animations.title_prompt.curr >= animations.title_prompt.final then
animations.title_prompt.curr = 0
end
if animations.title_prompt.curr < animations.title_prompt.threshold then
animations.title_prompt.active = true
else
animations.title_prompt.active = false
end
animations.title_prompt.curr += 1
camera(0,0)
end
function _update_intro()
if base > 5 then
base -= 0.5
end
if btnp(🅾️) then
sfx(45)
music(9)
_update = _update_walk
_draw = _draw_walk
end
end
function _update_walk()
move_player()
chk_dialog()
update_npcs()
update_animations()
update_camera()
end
function update_camera() -- used to keep camera in bounds
local ox = 56
local oy = 48
if p.x>56 and p.x<952 then
ox = p.x - 56
elseif p.x<= 56 then
ox = 0
elseif p.x>=952 then
ox = 896
end
if p.y>48 and p.y<176 then
oy = p.y - 48
elseif p.y<= 48 then
oy = 0
elseif p.y >= 176 then
oy = 128
end
cam.x = ox
cam.y = oy
camera(ox, oy)
end
function _update_dialog()
if btnp(🅾️) then
sfx(44)
if dialog.curr < #dialog.lines then
dialog.curr += 1
elseif dialog.battle then
-- enter battle minigame
-- choose correct enemy sprite
if dialog.active_npc.sprite == 77 then
battle.enemy_sprite = 251
elseif dialog.active_npc.sprite == 69 then
battle.enemy_sprite = 235
elseif dialog.active_npc.sprite == 65 then
battle.enemy_sprite = 250
elseif dialog.active_npc.sprite == 1 then
battle.enemy_sprite = 237
end
init_battle()
else
-- return to walking mode
-- add exp if talk to neighbor
if dialog.active_npc.sprite == 67 and p.exp == 3 then
p.exp += 1
spawn_dom()
end
_update = _update_walk
_draw = _draw_walk
end
end
update_bob_anim()
update_camera()
-- camera(p.x-60, p.y-60)
end
function init_battle()
-- spawn pickups
battle.pickups = {}
add(battle.pickups, {
sprite = 221,
x = flr(rnd(64)),
y = flr(rnd(64)),
w = 8,
h = 8,
active = true
})
add(battle.pickups, {
sprite = 221,
x = flr(rnd(64)),
y = 58+flr(rnd(64)),
w = 8,
h = 8,
active = true
})
add(battle.pickups, {
sprite = 221,
x = 58+flr(rnd(64)),
y = flr(rnd(64)),
w = 8,
h = 8,
active = true
})
add(battle.pickups, {
sprite = 221,
x = 58+flr(rnd(64)),
y = 58+flr(rnd(64)),
w = 8,
h = 8,
active = true
})
battle.p.x = 64
battle.p.y = 64
battle.enemies = {}
battle.collected = 0
battle.health = 4
music(3)
take_dmg()
_update = _update_start_battle
_draw = _draw_start_battle
end
function _update_start_battle()
animations.transition.curr += animations.transition.step
if animations.transition.curr >= animations.transition.final then
_update = _update_battle
_draw = _draw_battle
animations.transition.curr = 1
end
end
function _update_end_battle()
if animations.transition_end.curr >= animations.transition_end.final then
animations.transition_end.curr = 0
_update = _update_dialog
_draw = _draw_dialog
music(9)
else
animations.transition_end.curr += animations.transition_end.step
end
end
function _update_battle()
if btn(🅾️) and
battle.p.boost == 0 and
battle.p.boost_cooldown == 0 then
_speed = battle.p.boost_speed
battle.p.boost = battle.p.boost_duration
elseif battle.p.boost > 0 then
_speed = battle.p.boost_speed
battle.p.boost -= 1
if battle.p.boost == 0 then
battle.p.boost_cooldown = battle.p.boost_cooldown_max
end
else
_speed = battle.p.speed
if battle.p.boost_cooldown > 0 then
battle.p.boost_cooldown -= 1
end
end
-- player movement
if btn(⬅️) and battle.p.x > battle.p.speed then
battle.p.x -= _speed
elseif btn(➡️) and battle.p.x+8 < 127 then
battle.p.x += _speed
end
if btn(⬆️) and battle.p.y > battle.p.speed then
battle.p.y -= _speed
elseif btn(⬇️) and battle.p.y+8 < 127 then
battle.p.y += _speed
end
-- deplete iframes
if battle.invincibility > 0 then
battle.invincibility -= 1
end
-- pickup logic
for pickup in all(battle.pickups) do
if pickup.active then
if battle.p.x+battle.p.w >= pickup.x and
battle.p.x <= pickup.x+pickup.w and
battle.p.y+battle.p.h >= pickup.y and
battle.p.y <= pickup.y+pickup.h then
pickup.active = false
battle.collected += 1
sfx(47)
end
end
end
-- enemy spawning
if #battle.enemies < battle.enemy_max and rnd() < battle.enemy_spawn_chance then
spawn_enemy()
end
for e in all(battle.enemies) do
-- enemy collision check
if battle.p.x+battle.p.w >= e.x and
battle.p.x <= e.x+e.w and
battle.p.y+battle.p.h >= e.y and
battle.p.y <= e.y+e.h and
battle.invincibility == 0 then
take_dmg()
end
-- enemy movement
e.x += e.v.x
e.y += e.v.y
e.ttl -= 1
if e.ttl < 0 then
del(battle.enemies, e)
end
end
-- win condition
if battle.collected == #battle.pickups then
dialog.lines = dialog.active_npc.win_lines
dialog.active_npc.battle = false
dialog.battle = false
dialog.curr = 1
p.exp += 1
battle.enemy_spawn_chance += 0.1
if p.exp == 3 then -- see all 3 fakes
spawn_neighbor()
end
sfx(50)
battle_end()
end
-- loss condition
if battle.health <= 0 then
dialog.lines = dialog.active_npc.lose_lines
dialog.battle = false
dialog.curr = 1
sfx(49)
battle_end()
end
end
function battle_end()
music(-1)
_update_dialog()
_update = _update_end_battle
_draw = _draw_end_battle
end
function do_shake()
animations.shake.x = 16 - rnd(32)
animations.shake.y = 16 - rnd(32)
animations.shake.x *= animations.shake.strength
animations.shake.y *= animations.shake.strength
camera(animations.shake.x, animations.shake.y)
animations.shake.strength = animations.shake.strength*animations.shake.fade_factor
if animations.shake.strength < 0.05 then
animations.shake.strength = 0
end
end
function take_dmg()
sfx(46)
battle.health -= 1
battle.invincibility = battle.iframes
animations.shake.strength = animations.shake.max_strength
end
function spawn_enemy()
-- spawn enemy
_angle = flr(rnd(360))+1
_x = 64 + flr(rnd(127))-64 + 180*cos(_angle / 360)
_y = 64 + flr(rnd(127))-64 + 180*sin(_angle / 360)
_speed = rnd(battle.enemy_speed_range) + battle.enemy_min_speed
_xvel = -1 * _speed*cos(_angle/360)
_yvel = -1 * _speed*sin(_angle/360)
add(battle.enemies, {x = _x, y = _y, v = {x = _xvel, y = _yvel}, ttl = battle.enemy_ttl, w = 8, h = 8})
end
function move_player()
animations.p.dir = 0
if btn(⬅️) then
p.x -= p.speed
animations.p.dir = 1
if chk_npc_coll(0) or chk_map_coll(1) then
p.x += p.speed
end
elseif btn(➡️) then
p.x += p.speed
animations.p.dir = 2
if chk_npc_coll(0) or chk_map_coll(2) then
p.x -= p.speed
end
end
if btn(⬆️) then
p.y -= p.speed
animations.p.dir = 3
if chk_npc_coll(0) or chk_map_coll(3) or p.y <= -24 then
p.y += p.speed
end
elseif btn(⬇️) then
p.y += p.speed
animations.p.dir = 4
if chk_npc_coll(0) or chk_map_coll(4) or p.y >= 224 then
p.y -= p.speed
end
end
end
function chk_dialog()
-- prompt return to home
if p.exp == 3 and not p.prompt_final then
_update = _update_dialog
_draw = _draw_dialog
dialog.lines = return_prompt
dialog.curr = 1
p.prompt_final = true
end
-- end game
if p.exp == 5 then
music(17)
_draw = _draw_ending
_update = _update_ending
end
-- check whether to enter dialog mode
if btnp(🅾️) then
for npc in all(npcs) do
if npc.active then
-- enter dialog mode
sfx(44)
_update = _update_dialog
_draw = _draw_dialog
dialog.active_npc = npc
dialog.lines = npc.lines
dialog.battle = npc.battle
dialog.curr = 1
if npc.sprite == 67 then
music(1)
end
end
end
end
end
function update_npcs()
for npc in all(npcs) do
if dist(p.x, p.y, npc.x, npc.y) < p.interact_rad then
npc.active = true
else
npc.active = false
end
end
end
function spawn_neighbor()
npcs[4].x = 911
npcs[4].y = 190
end
function spawn_dom()
npcs[2].x = 435
npcs[2].y = 185
end
function update_animations()
update_bob_anim()
if animations.p.curr == animations.p.final then
animations.p.curr = 0
else
animations.p.curr += 1
end
if animations.p.curr < animations.p.final/2 then
animations.p.active = true
else
animations.p.active = false
end
end
function update_bob_anim()
if animations.bob.curr == animations.bob.final then
animations.bob.curr = 0
else
animations.bob.curr += 1
end
if animations.bob.curr < animations.bob.final/2 then
animations.bob.active = true
else
animations.bob.active = false
end
end
function _update_ending()
camera(0,0)
if base2 > 5 then
base2 -= 0.5
end
end
-->8
-- draw functions
function _draw_title()
cls(0)
rectfill(0, 0, 128, 90, 3)
-- T H E _ L O S T
local line1 = {71, 72, 73, 122, 74, 75, 124, 87}
-- M E M E N T O
local line2 = {108, 73, 92, 73, 76, 87, 75}
local wx = 36
local wy = 24
for l in all(line1) do
spr(l, wx, wy, 1, 1)
wx += 7
end
wy += 10
wx = 42
for l in all(line2) do
if l == 75 then
wx -= 4
end
spr(l, wx, wy, 1, 1)
wx += 7
end
if animations.title_prompt.active then
print("press 🅾️ to begin", 30, 64, 7)
end
print ("◆ggj 2021◆", 40, 100, 7)
print("joshua cepeda, erin markel,", 10, 108, 7)
print("luke reifenberg, tanner waltz,", 5, 114, 7)
print("and spencer wells ♥", 27, 120, 7)
end
function _draw_intro()
cls(3)
local _y = 5
for l in all(intro_text) do
if l[4] != nil then
_c = l[4]
else
_c = 7
end
print(l[2], l[3], flr(_y+base), _c)
_y += l[1]
end
if base <= 5 then
print("press 🅾️ to continue", 28, 118)
end
end
function _draw_walk()
cls(1)
-- draw map
map(0, 0, 0, 0, 128, 32)
-- draw player
draw_player()
-- draw npcs
draw_npcs()
-- draw objects
draw_objects()
end
function _draw_dialog()
-- draw the background
_draw_walk()
-- draw the dialog box
rectfill(cam.x+2, cam.y+2, cam.x+125, cam.y+32, 0)
rect(cam.x+2, cam.y+2, cam.x+125, cam.y+32, 7)
-- rectfill(p.x-60, p.y-60, p.x+64, p.y-32, 0)
-- rect(p.x-60, p.y-60, p.x+64, p.y-32, 7)
-- draw the text
local b = 0
for l in all(dialog.lines[dialog.curr]) do
print(l, cam.x+8, cam.y+8+b)
b += 6
end
-- dialog continue arrow
if animations.bob.active then
_offset = 1
else
_offset = 0
end
pset(cam.x+120, cam.y+27+_offset, 7)
rectfill(cam.x+119, cam.y+25+_offset, cam.x+121, cam.y+26+_offset, 7)
-- rectfill(p.x+58, p.y-38+_offset, p.x+60, p.y-37+_offset, 7)
-- pset(p.x+59, p.y-36+_offset, 7)
end
-- battle start cutscene
function _draw_start_battle()
_draw_dialog()
for a=1,animations.transition.curr,animations.transition.draw_step do
line(cam.x+64, cam.y+64, cam.x+64+(animations.transition.r*cos(a/360)), cam.y+64+(animations.transition.r*sin(a/360)), 5)
end
end
function _draw_end_battle()
_draw_dialog()
rectfill(cam.x, cam.y+animations.transition_end.curr, cam.x+127, cam.y+127, 5)
-- spr(battle.p.sprite, p.x - 50 + battle.p.x, battle.p.y - 58 + battle.p.y)
end
function _draw_battle()
-- camera(animations.shake.x, animations.shake.y)
cls(5)
do_shake()
-- draw creme brulee
for pickup in all(battle.pickups) do
if pickup.active then
spr(pickup.sprite, pickup.x, pickup.y)
end
end
-- draw enemies
for e in all(battle.enemies) do
spr(battle.enemy_sprite, e.x, e.y)
end
-- draw player
spr(battle.p.sprite, battle.p.x, battle.p.y)
if battle.invincibility > 0 then
circ(battle.p.x + 4, battle.p.y+4, 7, 7)
end
-- draw health croissants
for h = 1, battle.health do
spr(171, h*16-16, 110, 2, 2)
end
-- draw boost baguette
if battle.p.boost_cooldown == 0 then
spr(139, 110, 110, 2, 2)
end
-- instructions
print("collect all the creme brulee!", 6, 16, 0)
print("press z to boost", 24, 24, 0)
end
function draw_player()
-- draw player
if animations.p.dir == 0 then
spr(129, p.x, p.y, 2, 4)
elseif animations.p.dir == 1 then
if animations.p.active then
spr(131, p.x, p.y, 2, 4, true, false)
else
spr(133, p.x, p.y, 2, 4, true, false)
end
elseif animations.p.dir == 2 then
if animations.p.active then
spr(131, p.x, p.y, 2, 4, false, false)
else
spr(133, p.x, p.y, 2, 4, false, false)
end
elseif animations.p.dir == 3 then
if animations.p.active then
spr(137, p.x, p.y, 2, 4, false, false)
else
spr(137, p.x, p.y, 2, 4, true, false)
end
elseif animations.p.dir == 4 then