-
Notifications
You must be signed in to change notification settings - Fork 0
/
amoonshot.p8
2041 lines (1949 loc) · 76.5 KB
/
amoonshot.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 29
__lua__
--another moonshot
--@thomasmichaelwallace
--flags:
--0:blocks char
-- unless 4,4 is trans and map
-- has colour changer.
-- blocks looker sight unless
-- is in lk.t
--1:can be talked to
-- looks up tx[v] for dia.
--2:can host/is placeable
-- (+1) is host else placable
--3:can be pushed/pushed on
-- (+1) is pushable else on.
--4:can be cut
--5:can be collected
--6:is colour changer
--7:is swing hook
function _init()
_init_tit()
end
function _update60()
if(tl.v)then
_update_tit()
elseif(fd.m)then
_update_end()
else
_update_map()
if(dg.v)then
_update_dia()
else
_update_res()
_update_lok()
_update_fig()
_update_cut()
_update_swg()
end
end
end
function _draw()
cls()
if(tl.v)then
_draw_tit()
elseif(fd.m)then
_draw_end()
else
_draw_map()
_draw_lok()
_draw_fig()
_draw_dia()
_draw_cut()
end
end
-->8
--map system
mp={--map state
n=10,--map no.
x=0,--screen top-left x
y=0,-- /y
s={--scroll
t=false,--scrolling
n=0,--next map no.
d=0,--direciton 0⬅️➡️⬆️⬇️3
x=0,--n/map s/top-left x
y=0,-- /y
},
a={--animations
t=0,--tick
f=0,--frame no.
b=false,--blit.
},
m=-1,--current music
t={--music map
3, 3, 9,11,11, 2, 2, 9,
5, 2, 2, 7, 7, 2, 2, 5,
}
}
--n:sprite tile no
--sx/y:screen x/y
function mapn(n,sx,sy)
if(rb.c~=nil)then
--only affected
if(n==8 or n==15 or n==4)palt(rb.c,true)
end
local y=0
if(n>7)then
y=16
n-=8
end
local x=16*n
map(x,y,sx,sy,16,16)
--blit animation
if(mp.a.b)then
for ax=x,x+16,1 do
for ay=y,y+16,1 do
local m=mget(ax,ay)
if(m>=128 and m<=191)then
if(m%2==1)then
mset(ax,ay,m-1)
else
mset(ax,ay,m+1)
end
end
end
end
mp.a.b=false
end
if(rb.c~=nil)palt(rb.c,false)
end
function scroll_map()
local s=8--speed
if(mp.s.t)then
if(mp.s.d==1)then
mp.x-=s
mp.s.x-=s
fg.x-=s
if(mp.s.x<=0)mp.s.t=false
elseif(mp.s.d==0)then
mp.x+=s
mp.s.x+=s
fg.x+=s
if(mp.s.x>=0)mp.s.t=false
elseif(mp.s.d==3)then
mp.y-=s
mp.s.y-=s
fg.y-=s
if(mp.s.y<=0)mp.s.t=false
elseif(mp.s.d==2)then
mp.y+=s
mp.s.y+=s
fg.y+=s
if(mp.s.y>=0)mp.s.t=false
end
if(mp.s.t==false)then
mp.x=0
mp.y=0
mp.n=mp.s.n
mp.s.x=0
mp.s.y=0
end
end
end
--d:scroll direction 0⬅️➡️⬆️⬇️3
function move_map(d)
local n=mp.n
if(d==0)then--⬅️
if(n==0)return
if(n>4 and n<=8)return
if(n>12)return
mp.s.n=n-1
mp.s.x=-128
elseif(d==1)then--➡️
if(n>=4 and n<8)return
if(n>=12)return
mp.s.n=n+1
mp.s.x=128
elseif(d==2)then--⬆️
if(n==15)n=16
if(n==6)n=18
if(n<=1)return
if(n==2)n=15
if(n==3)return
if(n==4)n=21
if(n==7 or n==5)return
mp.s.n=n-8
mp.s.y=-128
elseif(d==3)then--⬇️
if(n==7)n=-6
if(n==13)n=-4
if(n==8)n=7
if(n==9)return
if(n==10)n=-2
if(n==11 or n==12)return
if(n==15 or n==14)return
mp.s.n=n+8
mp.s.y=128
end
--music
local t=mp.t[mp.s.n+1]
if(t==11 and not fd.o)t=2
if(mp.m~=t)then
mp.m=t
music(t)
end
--start scroll
mp.s.t=true
mp.s.d=d
end
function mxyget(x,y)
local mx,my=x/8,y/8
local n=mp.n
if(n>7)then
n-=8
my+=16
end
mx+=16*n
my=min(31,my)
return {mx=mx,my=my}
end
--x/y:screen x/y
function mgetp(x,y)
local p=mxyget(x,y)
return mget(p.mx,p.my)
end
--x/y:screen x/y
--v:map value
function msetp(x,y,v)
local p=mxyget(x,y)
--syncronise v with ani.
if(v>=128 and v<=191)v+=mp.a.f
return mset(p.mx,p.my,v)
end
function _update_map()
--animations
mp.a.t+=1
if(mp.a.t==24)then--frames/second
mp.a.t=0
mp.a.f=(mp.a.f+1)%2
mp.a.b=true
end
--scroll
if(mp.s.t)scroll_map()
end
function _draw_map()
mapn(mp.n,mp.x,mp.y)
if(mp.s.t)then
mapn(mp.s.n,mp.s.x,mp.s.y)
end
end
-->8
--dialogue system
dg={--dialogue state
v=false,--show
n="name",--name
t="text.",--text
s=64,--t/l sprite no.
i=1,--selected index
c=7,--text color
h=6,--highlight colour
o={{--dia.options list
t="ok",--text
f=function()end,--selected fn.
}}
}
ch={--character definitions
{
s=64,--sprite
n="ol' blue",--name
c=12,--highlight colour
},
{s=66 ,c=14,n="doribone gray"},
{s=68 ,c=14,n="pinky bryan"},
{s=70 ,c=10,n="c-dog"},
{s=96 ,c= 9,n="cap'n tango"},
{s=98 ,c= 8,n="baba junior"},
{s=100,c=12,n="baba seniors"},
{s=102,c= 4,n="space dog (you)"},
}
--n:t/l sprite no.
--w/h:width/height in sprites
--dx/dy:t/l screen position
--s:scale factor
function zspr(n,w,h,dx,dy,s)
local sx,sy=(n%16)*8,(n\16)*8
local sw,sh=8*w,8*h
local dw,dh=sw*s,sh*s
sspr(sx,sy,sw,sh,dx,dy,dw,dh)
end
--s:string
--lw:max pixel line width
function word_wrap(s,lw)
local l={}--lines
local b=""--buffer
local w=0--line width
local cl=""--current line
local cw=0--current width
local nl=false--new line
for n=1,#s do
nl=false
local c=sub(s,n,n)
if(ord(c)==32)then
cl,cw=cl..b,w
b=c
elseif(ord(c)==10)then
cl,cw=cl..b,w
b=""
nl=true
else
b=b..c
end
w+=4
if(ord(c)>127)w+=4
if(w>lw or nl)then
if(#cl==0)then
cl,cw=b,w
w+=4
b=" "
end
add(l,{t=cl,w=cw})
cl=""
b=sub(b,2)
w-=(cw+4)
end
end
cl=cl..b
add(l,{t=cl,w=w})
return l
end
--t:text
--x/y0/1:corners
--h/v:-101 l/c/r h/v align
--c:colour
function text_rect(t,x0,y0,x1,y1,h,v,c)
local rw=abs(x0-x1)
local rh=abs(y0-y1)
local ox=min(x0,x1)
local oy=min(y0,y1)
local lns=word_wrap(t,rw)
for n=1,#lns do
local l=lns[n]
local x=ox
if(h==0)x+=flr((rw-l.w)/2)+1
if(h==1)x+=(rw-l.w)+2
if(v==-1)y=6*(n-1)
if(v==0)y=flr((rh-6*#lns)/2)+6*(n-1)+1
if(v==1)y=rh-(6*(#lns-n+1))+2
y+=oy
print(l.t,x,y,c)
end
end
--i:tx data index/{cto}object
function show_dia(i)
local t=i
--lookup
if(type(i)=="number")then
--normalise farmers
if(i>=243 and i<=246)i=243
if(i>=247 and i<=250)i=247
--normalise statues
if(i==197)i=195
--normalise console
if(i==215 or i==216 or i==138 or i==139)i=215
--support fns
t=tx[i]
if(type(t)~="table")t=t()
end
if(t==nil)return--short circut
--apply
dg.i=1
dg.t=t.t
dg.n=ch[t.c].n
dg.h=ch[t.c].c
dg.s=ch[t.c].s
dg.o=t.o==nil and {tc.ok} or t.o
dg.v=true
end
function try_dia()
local c=fig_cast(4,1)
if(c==nil)return false
show_dia(c.m)
return true
end
function _update_dia()
if(not dg.v)return
if(btnp(2)and dg.i>1)dg.i-=1
if(btnp(3)and dg.i<#dg.o)dg.i+=1
if(btnp(4)or btnp(5))then
dg.v=false
local f=dg.o[dg.i].f
if(type(f)=="number")then
show_dia(f)
else
f()
end
end
end
function _draw_dia()
if(not dg.v)return
--frame
rectfill(11,11,117,117,0)
rect(12,12,116,116,dg.h)
rect(14,14,114,114,dg.h)
--portrait and header
zspr(dg.s,2,2,2,2,2)
print(dg.n,36,24,dg.h)
--body
text_rect(dg.t,17,36,110,111,-1,-1,dg.c)
--options
print("\n")
for i=1,#dg.o,1 do
if(i==dg.i)then
color(dg.h)
print("웃"..dg.o[i].t)
else
color(dg.c)
print(" "..dg.o[i].t)
end
end
end
-->8
--figure system
fg={--figure state
x=80,y=104,--screen x/y
a={--animation sprites
--⬅️➡️⬆️⬇️
-- - still-move-flip?
{{193,209},{209,208},false},
{{193,209},{209,208}, true},
{{224,240},{194,210},false},
{{225,241},{226,242},false},
},
d=4,--direction no: 1⬅️➡️⬆️⬇️4
m=false,--moving?
t=0,--tick
f=1,--animation frame no (1/2)
}
--m:map tile no
--f:flag to check for
function fpget(m,f)
local b=fget(m,f)
if(not b)return false
if(f>0)return true
if(rb.c==nil)return true
local x,y=(m%16)*8+4,(m\16)*8+4
local c=sget(x,y)
return c~=rb.c
end
--l:length in dir to check
--f:flag to check for
function fig_cast(l,f)
--ok:should clip:
--if(f==0)return false
--fig t/l
local h=7--sprite height
local w=6--/width
--checkpoints 0,1
local x0=fg.x+(8-w)/2
local y0=fg.y+(8-h)
local x1,y1=x0,y0
if(fg.d==1)then--⬅️
x0-=l
x1,y1=x0,y0+h-1--:웃
elseif(fg.d==2)then--➡️
x0+=w+l-1
x1,y1=x0,y0+h-1--웃:
elseif(fg.d==3)then--⬆️
y0-=l --..
x1,y1=x0+w-1,y0--웃
elseif(fg.d==4)then--⬇️
y0+=h+l-1 --웃
x1,y1=x0+w-1,y0--''
end
local m0,m1=mgetp(x0,y0),mgetp(x1,y1)
local c=nil
if(fpget(m0,f))then
c={m=m0,x=x0,y=y0}
elseif(fpget(m1,f))then
c={m=m1,x=x1,y=y1}
else
return nil
end
--normalise anis.
if(c.m>=128 and c.m<=191)c.m-=c.m%2
return c
end
function move_fig()
local s=1/3--ok:1/3--speed
local m=fig_cast(s,0)
--workaround 7 south block
if(mp.n==7 and fg.y>118 and fg.d==4)m=nil
if(m)return false
if(fg.d==1)fg.x-=s
if(fg.d==2)fg.x+=s
if(fg.d==3)fg.y-=s
if(fg.d==4)fg.y+=s
return true
end
function try_scroll()
if(fg.x<-4)then
move_map(0)
elseif(fg.x>124)then
move_map(1)
elseif(fg.y<-4)then
move_map(2)
elseif(fg.y>124)then
move_map(3)
end
end
function _update_fig()
if(mp.s.t)return--scrolling
if(hk.s)then--swinging
try_scroll()
return
end
--control
local m=true
if(btn(0))then
fg.d=1
elseif(btn(1))then
fg.d=2
elseif(btn(2))then
fg.d=3
elseif(btn(3))then
fg.d=4
else
m=false
end
--collide
if(m)then
try_push()
try_collect()
m=move_fig()
end
--scroll
try_scroll()
--interact
if(btnp(4)or btnp(5))then
if(try_dia())then
--sideeffects
elseif(try_place())then
elseif(try_col())then
elseif(try_swing())then
elseif(try_cut())then
end
end
--ticker
fg.t+=1
if(m~=fg.m)then
fg.m=m
fg.t=0--restart
end
if(fg.t==24)then
fg.t=0
fg.f+=1
if(fg.f==3)fg.f=1
end
end
function _draw_fig()
local a=fg.a[fg.d]
local m=fg.m and 2 or 1
local s=a[m][fg.f]
spr(s,fg.x,fg.y,1,1,a[3])
end
-->8
--text resources
tc={--text constants
ok={t="ok",f=function()end},
no={t="no",f=function()end},
rs={t="no",f=function()
do_reset()
end}
}
ts={
"thanks for bringing our village back together again, good luck with the moonshot!",
"what a landing... that ship looks pretty busted; there's bits scatted throughout this village.",
"i found one, but- would you help an old man see his wife one more time; i'm too old to walk to her monolith these days.",
"it is to the east, you'll have to push it along the path, press ❎ to pick up and put down logs.",
"this used to be such a happy place; maybe you can make it so again as you pick up the pieces.",
"thanks for bringing my wife to me, it's nice to have her close again. when you've got all the pieces, head north-east.",
"wow. it's great to have her so close again. here's the piece of your ship.",
"return the monolith back to where it started?",
"thanks for cutting the grass; gives the village some respect.",
"the falling debris scared away all the fish. i picked it up, but you owe me 20 coins. press ❎ to cut down long grass and find coinage.",
"ok, that's 20, you can have your piece.",
"wow, you found them all!",
"seeing that trophy reminded me of how happy i was competing, i'm too old now- but maybe i can start helping others...",
"this shard recked my store room, just save my gymnastics trophy and you can get it back",
"press ❎ to swing on hooks. you might need to use your sword (❎) to dislodge the stuck hooks.",
"wow, this brings back memories... you can have this back.",
"so many memories...",
"looks like the trophy. i should bring it back.",
"ok- let's swap the spade for this hoe and bring that back...",
"ok- let's take this hoe to swap it with the spade...",
"ok, i'll put the hoe back for now.",
"swap complete! and what's this- a piece of your ship!",
"hey! you put my hoe back this instant!",
"hey! you keep that spade away from my field!",
"hmm- you know- this spade isn't all that bad...",
"i love my hoe. won't touch a spade. unlike my brothers. if you can steal their spade it'll make my day.",
"hey- thanks. together- hoe and spade, us brothers are making good on the land.",
"ok - let's swap the hoe for this spade and bring that back...",
"ok - let's take this spade and swap it with the hoe...",
"ok, i'll put the spade back for now.",
"swap complete! and what's this- a piece of your ship!",
"oi! get back here with my spade!",
"oi! get that hoe outta my field!",
"hmm- you know- this hoe isn't all that bad...",
"i love my spade. won't touch a hoe. unlike my brother. if you can steal their hoe it'd make our day.",
"hey- thanks. together- hoe and spade, us brothers are making good on the land.",
"thanks for bringing me and my son back together again.",
"you delivered my message? thank you, i shouldn't have waited so long...",
"hmm- nothing landed here, but maybe you can help me get through to my son and ask him?",
"press ❎ to switch the color changers and clear the way",
"we don't always see eye to eye, but he is my dad - thank you.",
"my dad sent you? wow, it's been so long since he reached out...",
"you can have this- i found it in the garden.",
"ok- let's get back to the ship!",
"it's time to go- for another moonshot."
}
tx={--text resources
[0]={--sprite no.
c=1,--ch index
t="test",--text block
o={{--options list
t="ok",--text
f=function()end--sel.function
}}
},
--statue/old blue
[176]=function()
if(fd.o)then
return{
c=1,
t=ts[1]--end game
}
end
local t=ts[2] --what a landing
local o={{t="the village?",f=176.1}}
if(not pu.f)then
o[2]={t="the pieces?!",f=176.2}
else
t=ts[6]--thanks for wife
end
o[#o+1]=tc.ok
return {c=1,t=t,o=o}
end,
[176.1]={
c=1,
t=ts[5]--about village
},
[176.2]={
c=1,
t=ts[3],--start of statue expl.
o={{t="...",f=176.21}}
},
[176.21]={
c=1,
t=ts[4]--end of statue expl.
},
[176.3]={
c=1,
t=ts[7]--statue into position
},
[195]=function()
if(pu.f)return nil
if(mp.n<11 or mp.n>12)return nil
return {
c=8,
t=ts[8], --reset statue
o={tc.no,{
t="yes",
f=function()
do_reset()
end,
}}
}
end,
--coin man
[162]=function()
if(fd.o)then
return{
c=4,
t=ts[9],--"good bye from yellow."
}
end
if(sw.n==0)then
t=ts[10]--"get me coin"
else
t="nice try, but you've only got "..tostr(sw.n).." coins, i want 20!"
end
if(sw.n>=20)then
if(not sw.w)then
t=ts[11]--you have piece now.
sw.w=true
elseif(sw.n>=40)then
t=ts[12].."★✽●♥웃🐱♪😐"--"you found them all!"
elseif(sw.n>=20)then
t="you know, there's 40 coins about, and you only found "..tostr(sw.n).." just saying."
end
end
return {c=4,t=t}
end,
--swings
[144]=function()
if(fd.o)then
return{
c=5,
t=ts[13],--"good bye from item lost."
}
end
local t=ts[14]--"i have lost item. find it"
if(hk.w)then
t=ts[17] --"thank you for item."
elseif(hk.c)then
t=ts[16] --"thank you for item. have your one"
hk.w=true
else
--normal
return {c=5,t=t,o={{t="...",f=144.1}}}
end
return {c=5,t=t}
end,
[144.1]={
c=5,
t=ts[15],--expl of swing
},
[180]=function()
sfx(12)
return {
c=8,
t=ts[18],--"got item",
o={{
t="let's go!",
f=function()
hk.c=true
mset(20,14,32)
end
}},
}
end,
--looker
[150]=function()--lk red tool
if(lk.p.r)return nil--placed
lk.h.r=true
if(lk.h.b)then--swaping
lk.h.b=false
lk.p.b=true
sfx(12)
mset(36,10,134)
return{
c=8,
t=ts[19]--"put blue where red is and swap."
}
else--first time
sfx(12)
mset(36,10,152)
return {
c=8,
t=ts[20]--"take red thing",
}
end
end,
[152]=function()--lk red bench
if(lk.h.r)then
lk.h.r=false
mset(36,10,150)
return {
c=8,
t=ts[21]--"put back red thing",
}
elseif(lk.h.b)then
lk.h.b=false
lk.p.b=true
sfx(12)
mset(36,10,134)
return {
c=8,
t=ts[22]--"you win red then blue."
}
else
return nil
end
end,
[243]=function()--lk red
if(lk.h.r)then
sfx(13)
return {
c=6,
t=ts[23],--"you stole my red tool!",
o={tc.rs}
}
elseif(lk.h.b)then
sfx(13)
return {
c=6,
t=ts[24],--"get that blue tool away!",
o={tc.rs}
}
elseif(lk.p.r and lk.p.b)then
return {
c=6,
t=ts[25]--"you won and that was something red"
}
else
return {
c=6,
t=ts[26]--"don't steal my red tool or else",
}
end
end,
[168]={
c=6,
t=ts[27]--"good bye from red tools."
},
[134]=function()--blue tool
if(lk.p.b)return nil--placed
lk.h.b=true
if(lk.h.r)then--swaping
lk.h.r=false
lk.p.r=true
sfx(12)
mset(125,2,150)
return {
c=8,
t=ts[28]--"put down the red tool and swap it for blue!"
}
else--first time
sfx(12)
mset(125,2,136)
return {
c=8,
t=ts[29]--"take blue thing",
}
end
end,
[136]=function()--lk blue bench
if(lk.h.b)then
lk.h.b=false
mset(125,2,134)
return {
c=8,
t=ts[30]--"put back blue thing",
}
elseif(lk.h.r)then
lk.h.r=false
lk.p.r=true
sfx(12)
mset(125,2,150)
return {
c=8,
t=ts[31]--"you win blue then red."
}
else
return nil
end
end,
[247]=function()--lk blue
if(lk.h.b)then
sfx(13)
return {
c=7,
t=ts[32],--"oit! that's my blue tool.",
o={tc.rs}
}
elseif(lk.h.r)then
sfx(13)
return {
c=7,
t=ts[33],--"get that red tool out of here!",
o={tc.rs}
}
elseif(lk.p.r and lk.p.b)then
return {
c=7,
t=ts[34]--"you won and that was something blue"
}
else
return {
c=7,
t=ts[35]--"don't steal my blue tool or else",
}
end
end,
[184]={
c=7,
t=ts[36]--"good bye from blue tools."
},
--father/son
[160]=function()
--dad/pink
if(fd.o)then
return{
c=3,
t=ts[37]--"good bye from pink dad."
}
end
if(rb.w)then--won
return {
c=3,
t=ts[38],--"thank you for talk son",
}
else
return {
c=3,
t=ts[39],--"talk to my son",
o={{t="...",f=160.1}}
}
end
end,
[160.1]={
c=3,
t=ts[40]
},
[178]=function()
--son/black
if(fd.o)then
return{
c=2,
t=ts[41]--"good bye from balck son."
}
end
if(rb.w)then--won
return {
c=2,
t=ts[42],--"thank you for message",
}
else
rb.w=true
return {
c=2,
t=ts[42].."\n"..ts[43],
}
end
end,
--gate
[182]=function()
local i=0
if(pu.f)i+=1--statue
if(sw.w)i+=1--coins
if(rb.w)i+=1--rainbow
if(lk.p.r and lk.p.b)i+=1--lkr
if(hk.w)i+=1
local t="hmm - i can't head back to the ship until i find "..tostr(5-i).." more parts."
if(i>=5)then
sfx(12)
t=ts[44]
fd.o=true--final dungon open
music(-1)
music(11)--start ending music
mp.m=11
mset(51,10,46)
else
fd.c+=1
if(fd.c>10)then
return {
c=8,
t=t,
o={tc.ok,{
t="force it...",
f=function()
pl.n=2
sfx(12)
t=ts[44]
fd.o=true--final dungon open
music(-1)
music(11)--start ending music
mp.m=11
mset(51,10,46)
end,
}},
}
end
end
return {c=8,t=t}
end,