-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathminijam112.p8
1831 lines (1510 loc) · 76.9 KB
/
minijam112.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 36
__lua__
-- minijam 112: chronos
-- louiechapm & yolwoocle
-- main
debug=""
debugmode=true
sound_on=true
function _init()
t=0
anim={}
pal({[0]=129,1,12,14,7,140},1)
palt(0,false)palt(15,true)
poke(0x5f2e,1)
--camera
shake=0
in_menu=true
menu_new_dialogue_wait=400
report_fin_time=0
cam={
dobj=create_dobj(-133,-200),
}
report={
dobj=create_dobj(130,-90),
target_x=24,
last_input=0,
step=1,
adj1="",
sticker=false,
sticker_spr=130+flr(rnd(5))*2,
sticker_ox=rnd(6)-3,
sticker_oy=rnd(6)-3,
cur_mark=0,
signature=false,
}
logo={
default_x=18,
default_y=-80,
dobj=create_dobj(18,-80),
}
c={
dobj=create_dobj(63,63),
sel_index=1,
mode="launch"
}
ticks={false,false,false}
time_since_last=0
dialogue_queue=""
dialogue_queue_time=0
pot={
ingr={},
ingr_num=0,
_x=22,
_y=90,
name=rnd(potion_types),
score=0,
points={}
}
cur_fx_dobj={
dobj=create_dobj(3,25),
target=nil,
dx=3,
dy=25,
}
potion={
dobj=create_dobj(50,0),
target_y=40,
}
dead_list={}
dead_list_obj={
dobj=create_dobj(135,0)
}
bubbles={}
conveyor_time=0 --conveyor time
conv_mod=nil
conv_default=5
spawn_rate=80
ailment_manager=
{
big_a="", --string containing ailment name
solutions={}, --list containing all the "solution strings"
customer=generate_name()
}
past_customers={}
parse_speed=3
text_parse=""
ailment=""
parse_length=0
parsing=true
parse_output=""
ailment_out=""
hide_bubble=false
ingr_particles={}
doctor_oy=0
g_ingredients={
}
bubble_dobj=create_dobj(0,-10)
speech_arrow_up=false
time_percentage=0
clock=0
maxclock=60*60 -- be careful about overflowing the tiny p8 limit
report_shifted_on_left = false
bubbles_on_foreground = false
time_before_confetti=-1
spoon={
dobj=create_dobj(0,0)
}
--credits stuff--
credits_text={"made by","LOUIE CHAPMAN THE ","YOLWOOCLE THE "}
lou_adj=rnd(positive_adj)
yol_adj=rnd(positive_adj)
while #lou_adj+#credits_text[2]>27 do
lou_adj=rnd(positive_adj)
end
while #yol_adj+#credits_text[3]>27 do
yol_adj=rnd(positive_adj)
end
anim_to_point(cam,nil,-91,0.9)
prog_launch=0
music(0)
end
function _update60()
t+=1
update_cursor()
if c.mode=="launch" then
prog_launch+=1
if prog_launch==400 or btnp(❎) or btnp(🅾️) or btnp(⬅️) or btnp(➡️) then
c.mode="menu"
anim_to_point(cam,0,-91,0.9)
sfx(58)
new_dialogue("I CANT WAIT TO ","HELP"," PEOPLE TODAY!")
end
end
conv_mod=conv_default
if(time_percentage>30)conv_mod=4 spawn_rate=75
if(time_percentage>50)conv_mod=3 spawn_rate=50
if(time_percentage>70)conv_mod=2 spawn_rate=30
update_time()
leave_menu()
update_menu()
--if(report_shifted_on_left) dead_list_obj.dobj.oy-=1/6
menuitem(3, "sound: "..(sound_on and "on" or "off"), function() sound_on=not sound_on end)
menuitem(4, "end day", function() clock=maxclock-2 end)
if(conveyor_active)conveyor_time+=1 --only iterate spawn timer is the conveyor is active
time_since_last+=1
if dialogue_queue!="" and time_since_last>dialogue_queue_time then
new_dialogue(unpack(dialogue_queue))
dialogue_queue=""
end
animate_score_mode()
local nums=split"90,103,173,302"
for num in all(nums) do
if(t%num==0)spawn_bubble()
end
if dy(cur_fx_dobj.dobj)!=25 and cur_fx_dobj.target==t and c.mode=="ingredients" then
anim_to_point(cur_fx_dobj,cur_fx_dobj.dx,cur_fx_dobj.dy)
end
-- update doctor bop
doctor_oy=lerp(doctor_oy,0,0.5)
if(abs(doctor_oy)<0.1)doctor_oy=0
if parsing and t%5==0 then
doctor_oy+=1
end
-- spawn confetti
if(time_before_confetti >-1)time_before_confetti-=1
if time_before_confetti==0 then
sfx(60)
for i=1,30 do
spawn_confetti(-5,-10, 10+rnd(80), -10-rnd(50), 0.05+rnd(0.1))
spawn_confetti(128+5,-10, -10-rnd(80), -10-rnd(50), 0.05+rnd(0.1))
end
end
animate_ingredients()
animate_bubbles()
animate_ingr_particles()
parse_dialogue()
update_anim()
conveyor_spawner()
end
function _draw()
cls(2)
screen_shake()
camera(dx(cam.dobj),dy(cam.dobj))
rectfill(-150,35,130,130,0)
draw_pot()
draw_bubbles()
rectfill(-150,110,130,130,0)
draw_conveyor()
draw_effects()
draw_potion_names()
if not in_menu then
draw_ingredients()
draw_ingr_particles()
if(g_ingredients[c.sel_index]!=nil)selected_effects()
end
rectfill(-5,-40,60,30,2)
draw_time()
draw_report()
draw_dead_list()
draw_pdoctor()
draw_bubble()
draw_ticks()
draw_cursor()
--draw dialogue / bubble / speech
if(not hide_bubble)then
print(parse_output,6,5+dy(bubble_dobj),5)
print(ailment_out,6,5+dy(bubble_dobj),3)
end
draw_logo()
draw_credits()
if(bubbles_on_foreground)draw_bubbles()
if(debugmode)print(debug,1,dy(cam.dobj),8)
end
function reset_data()
--reset clocks
clock=0
time_since_last=0
conveyor_time=0
past_customers={}
dead_list={}
report.step=1
report.adj1=""
report.sticker=false
report.cur_mark=0
report.signature=false
report.last_input=0
bubbles_on_foreground=false
report_fin_time=0
ticks={false,false,false}
hide_bubble=false
report.dobj.wx=130
dead_list_obj.dobj.wx=135
g_ingredients={}
spawn_rate=80
end
function init_and_start_round()
in_menu=false
reset_data()
--animate stuff
anim_to_point(cam, 0,0, 0.9)
anim_to_point({dobj=bubble_dobj}, 0,0, 0.9)
speech_arrow_up=true
--this is scuffed as fuck don't tell yol
c.dobj.wx=-30
c.dobj.wy=100
add(g_ingredients,object)
--get new ailment and return to belt
new_ailment()
return_to_belt()
end
-->8
--update
function draw_potion_names()
local _text="potion of"
local _y=dy(potion.dobj)
text_bold2(_text,hcentre(_text)-35,_y,4,5)
text_bold2(pot.name,hcentre(pot.name)-35,_y+7,4,5)
end
function draw_dead_list()
-- draw dead list
local x,y=dx(dead_list_obj.dobj),dy(dead_list_obj.dobj)
--local x,y=30,dy(dead_list_obj.dobj)
rrect(x,-87+1,61,90,1)
rrect(x,-87 ,61,90,4)
local _x=x+1
local text_gap=35
local scroll=t*0.1
for i=0,#dead_list-1 do
local y_pos=(i*text_gap)
local y_pos=(y_pos-scroll)%(text_gap*#dead_list)
print(dead_list[i+1],x+1,-120+y_pos,5)
end
--print(dead_list,x+1,y,5)
-- foreground (to hide list)
rectfill(x,-91,128,-88, 2)--blue top
rectfill(x,5,128,3+31, 2)--blue bottom
rectfill(x+1,4,128,4, 0)--lback shadow
rectfill(x,35,128,37, 0)--black bottom
end
function update_menu()
if(c.mode!="menu")return
local phrases={
pack("IM SO"," EXCITED"," !"),
pack("I"," LOVE"," YOU !"),
pack("I CAN'T WAIT TO "," HELP"," EVERYONE TODAY !"),
pack("MY POISON IS YOUR"," MEDICINE"," !"),
pack("MEDICINE IS MY"," PASSION"," !"),
pack("YOU LOOK SO"," GOOD"," TODAY !"),
pack("ALWAYS REMEMBER TO LIVE , LAUGH , AND"," LOVE"," !"),
pack("THE REAL FRIENDS ARE THE"," POTIONS "," WE MADE ALONG THE WAY !"),
pack("IF LIVE GIVES YOU"," LEMONS"," MAKE LEMONAIDE !"),
pack("EVERYTHING HAPPENS FOR A"," REASON"," !"),
pack("IM SO"," PROUD"," OF YOU !"),
}
if(time_since_last%menu_new_dialogue_wait==0 and not parsing and c.mode=="menu")then
new_dialogue(unpack(rnd(phrases)))
menu_new_dialogue_wait=flr(400+rnd(200))
time_since_last=0
end
end
function update_dead_list()
local ways_to_die=split" WAS NEVER SEEN AGAIN, STILL GETS NIGHTMARES, HASNT STOPPED CRYING,S FAMILY MISSES THEM, NEVER MADE IT HOME, WILL NEVER RETURN, DIED A GRUESOME DEATH, LEFT THEIR WALLET, IS SUFFERING ANXIETY, HASNT EATEN IN DAYS, WAS ARRESTED, IS NOW IN JAIL, SUFFERED A FATE WORSE THAN DEATH, IS NOT THE SAME ANYMORE, COULDNT HANDLE OUR STRONGEST POTIONS"
local died_of_variations=split" DIED OF "
for customer in all(past_customers) do
if customer.score<0 then
local fate=rnd(ways_to_die)
if(flr(rnd(2))==0 and #customer.cause<20)fate=rnd(died_of_variations)..customer.cause
local fit=to_fit(customer.name..fate.."\n\n",11)
add(dead_list,fit)
end
end
if #dead_list!=0 then
while(#dead_list<4) do
add(dead_list,rnd(dead_list))
end
end
dead_list_obj.dobj._y=200
dead_list_obj.dobj.oy=0
end
function return_to_belt()
c.mode="ingredients"
conveyor_active=true
ticks={false,false,false}
new_ailment()
end
function animate_ingredients()
for ingredient in all(g_ingredients) do
local offset=0
if(conveyor_time%conv_mod==0 and conveyor_active)offset=1
ingredient.dobj.wx+=offset
--destroy ingredient if it goes off screen
if ingredient.dobj.wx>128 then
del(g_ingredients,ingredient)
c.sel_index=mid(1,c.sel_index-1,#g_ingredients) --fix weird cursor thing
end
end
end
function update_cursor()
if c.mode=="menu" then
if(btnp(⬅️) or btnp(➡️) and time_since_last!=0) then
c.mode="credits"
credits_new_adj()
anim_to_point(cam,-133,-91,0.9)
sfx(58)
return
end
end
if c.mode=="credits" then
if(btnp(⬅️) or btnp(➡️) and time_since_last!=0) then
c.mode="menu"
anim_to_point(cam,0,-91,0.9)
sfx(58)
return
end
end
if c.mode=="ingredients" then
for i=0,1 do --move cursor direction from input
if btnp(i) then
sfx(61)
local dir=split"1,-1"
c.sel_index=mid(1,c.sel_index+dir[i+1],#g_ingredients)
end
end
local ingr=g_ingredients[c.sel_index]
if #g_ingredients>0 and ingr!=nil then --animate to selected ingredient location
local ox,oy=10,8
anim_to_point(c,dx(ingr.dobj)+ox,dy(ingr.dobj)+oy,0.9)
if btnp(❎) and time_since_last>30 and #g_ingredients>1 then
local a_in={
dobj=ingr.dobj,
_s=ingr.obj._s,
spawn=0,
death=60,
_tx=10+rnd(22), --22 is middle
_ty=70+rnd(5),
ox=dx(ingr.dobj),
ny=0,
vy=-2.5-rnd(),
gravity=0.1,
} --animation ingredient
--anim_to_point(a_in,a_in._tx,a_in._ty,0.95)
a_in.dobj.oy=1
add(ingr_particles,a_in)
anim_to_point(cur_fx_dobj,nil,10)
del(g_ingredients,ingr)
commit_ingredient(ingr.obj)
sfx(58)
cur_fx_dobj.target=t+60
time_since_last=0
c.sel_index=mid(1,c.sel_index,#g_ingredients) --fix cursor
end
end
end
end
--spawns objects onto the
--conveyor
function conveyor_spawner()
if conveyor_time%spawn_rate==0 and conveyor_active then
local object={
obj=generate_ingredient(),
dobj=create_dobj(-20,95+rnd(10))
}
add(g_ingredients,object)
end
end
--commits the selected ingredient
--to the brew , and chooses
--a random effect to add
function commit_ingredient(_ingr)
local effect=nil
i=1
local points=flr(rnd(6))-4
for _fx in all(_ingr.effects) do
if in_list(ailment_manager.solutions,_fx) then
effect=_ingr.effects_modified[i]
points=flr(rnd(5))+5
end
i+=1
end
if(not effect)effect=rnd(_ingr.effects_modified)
add(pot.points,points)
add(pot.ingr,effect)
pot.ingr_num+=1
pot.score+=points
if pot.ingr_num>=3 then
--cam_y_active=true
c.mode="pot" --change cursor mode
anim_to_point(c,pot._x,pot._y,0.95)
anim_to_point(cur_fx_dobj,nil,-50)
local format=rnd(result_dialogue)
--check scores and create new dialogue
if(pot.score>5) then
adjectives=positive_adj
elseif(pot.score<5) then
adjectives=negative_adj
else
adjectives=neutral_adj
end
--set up dialogue queue
dialogue_queue=pack(format[1]..ailment_manager.customer.." "..format[2].." ",rnd(adjectives),format[3])
dialogue_queue_time=120
--add customer to past_customers list
add(past_customers,{name=ailment_manager.customer,score=pot.score,cause=ailment_manager.big_a})
--stop the conveyor
conveyor_active=false
--generate new potion name
pot.name=rnd(potion_types)
time_since_last=0
--new_ailment()
end
end
function update_time()
if(c.mode=="ingredients")clock+=1
if clock==maxclock then
--end game
c.mode="report"
clock=0
conveyor_active=false
logo.dobj.wx=130
--anim_to_point(c,,130,0.97)
dialogue_queue=pack("LOOKS LIKE ITS TIME TO CLOSE UP SHOP ","","")
dialogue_queue_time=30
time_since_last=0
end
if(c.mode!="report")return
local _x,_y=dx(report.dobj),dy(report.dobj)
if time_since_last==0 then
anim_to_point(c,nil,150,0.9)
end
if time_since_last==350 then
anim_to_point({dobj=bubble_dobj}, 0, -10, 0.9)
speech_arrow_up=false
anim_to_point(cam, 0, -91, 0.9)
in_menu=true --tells things that we're back on the menu, baby !
end
if time_since_last==430 then
local adjectives=split" WONDERFUL , FANTASTIC , EXCITING "
new_dialogue("WHAT A",rnd(adjectives),"DAY !")
end
if time_since_last==700 then
hide_bubble=true
anim_to_point(report, report.target_x, nil, 0.9)
update_dead_list()
end
if(time_since_last==720)anim_to_point(c,_x+10,_y+25,0.9)
--report card input loop
if(time_since_last>750 and time_since_last>report.last_input+30 and btnp(❎)) then
local c_anim_speed=0.9
if(report.step==1)report.adj1=rnd(positive_adj)
if(report.step==2)report.sticker_ox=-3+rnd(6)report.sticker_oy=-3+rnd(6)report.sticker=true
if(report.step>2 and report.step<=7)report.cur_mark+=1
if(report.step==8)report.signature=true
if(report.step<9)then
if(report.step!=0)sfx(47+report.step)shake=0.1
if(report.step==8)sfx(55)shake=0.2
end
if(report.step==1)anim_to_point(c,_x+70,_y+30,c_anim_speed)
if(report.step>=2 and report.step<=6)anim_to_point(c,_x+8,_y+45+((report.step-2)*8),c_anim_speed)
if(report.step==7)anim_to_point(c,_x+50,_y+90,c_anim_speed)
if(report.step==8)anim_to_point(c,_x+50,_y+100,c_anim_speed) --move hand away after signature
if(report.step==8) then
report_fin_time=time_since_last
time_before_confetti=50
bubbles_on_foreground=true
anim_to_point(c,nil,45,0.95)
end
report.last_input=time_since_last
report.step+=1
end
if time_since_last==900 and #dead_list!=0 then
-- Shift report card to left
anim_to_point(report, report.target_x-23, nil, 0.9)
anim_to_point(c,c.dobj.wx-23,nil,0.9)
anim_to_point(dead_list_obj, 83, nil, 0.9)
report_shifted_on_left = true
end
--finished the report
if report_fin_time>0 then
local time_since_fin=time_since_last-report_fin_time
if(time_since_fin==120)anim_to_point(report,130,nil)
--to finish the round
if(time_since_fin==150) then
to_menu()
end
end
end
function to_menu()
c.mode="menu"
in_menu=true
time_since_last=0
report.dobj.wx=150
anim_to_point(dead_list_obj,135,nil,0.9)
logo.dobj.wx=logo.default_x
logo.dobj.wy=-130
anim_to_point(logo,nil,logo.default_y,0.95)
hide_bubble=false
new_dialogue("I CANT WAIT TO ","HELP"," PEOPLE TODAY!")
end
function draw_time()
if(in_menu)return -- "this is scuffed as fuck I hate this line" - Louie
time_percentage=(clock/maxclock)*100
local start_time,end_time=9,17
local shift_length=end_time-start_time
local h_length=(100/shift_length)
local h_hand=(start_time+((time_percentage\h_length)%12))
local m_hand=15*(flr((time_percentage/(h_length)*60)%60)\15)
--[[
local leftt = maxclock - clock
local leftsecs= leftt\60
local timesec = leftsecs%60
local timemin = leftsecs\60
]]--
local _end="AM"
if(h_hand<start_time)_end="PM"
local m = sub("000"..tostr(flr(m_hand)), -2,-1)
local h = sub(" "..tostr(flr((h_hand-1)%12)+1), -2,-1)
-- flashing text
local ocol = 4
if (time_percentage>90 and t%60<=30) ocol=3
local out=h..":"..m.._end
if(clock==0)out=" 5:00PM"
text_bold(out,99,3, 0,ocol)
end
-->8
--draw
--draw plague doctor
function draw_pdoctor()
local _x,_y=89,8
local oy=doctor_oy
if parsing then
sspr(88,0,36,27,_x+2,_y+oy)
else
sspr(0,0,36,27,_x,_y+oy)
end
pset(_x+19,_y+27+oy,4)
pset(_x+19,_y+28+oy,4)
pset(_x+20,_y+27+oy,4)
pset(_x+18,_y+27+oy,4)
end
function draw_logo()
sspr(0,100,91,28,dx(logo.dobj),dy(logo.dobj)+sin((t*0.5)/120)*3.99)
end
function draw_ticks()
local _x,_y=80,40
for i=1,3 do
if ticks[i] then
local text=pot.points[i] or "0"
if text>=0 then text="+"..text end
text_bold(text,_x,_y+i*15,7,1)
end
end
end
--draw speech bubble
function draw_bubble()
if(hide_bubble)return
local _x,_y=3,3
local _w,_h=78,28
local ox = 0
local oy = dy(bubble_dobj)
--78 is normal width
_w=min(8+#parse_output*4,78)
rrect(_x,_y+oy+1,_w,_h,1)
rrect(_x,_y+oy,_w,_h,4)
local spry=speech_arrow_up and 4 or 20
sspr(0,27,7,5, _x+_w+1, _y+spry+oy+1)
sspr(37,0,7,5, _x+_w+1, _y+spry+oy)
end
function credits_new_adj()
lou_adj=rnd(positive_adj)
yol_adj=rnd(positive_adj)
while #lou_adj+#credits_text[2]>27 do
lou_adj=rnd(positive_adj)
end
while #yol_adj+#credits_text[3]>27 do
yol_adj=rnd(positive_adj)
end
end
function draw_credits()
local _x,_y=-133,-91
local _c1,_c2=5,3
local _y0,_y1,_y2=27+_y,40+_y,47+_y
--made by
rrect(hcentre(credits_text[1])-3+_x,_y0-3,32,11,1)
rrect(hcentre(credits_text[1])-3+_x,_y0-3,32,10,7)
print(credits_text[1],hcentre(credits_text[1])+_x,_y0,5)
--names
local w1,w2=(#credits_text[2]+#lou_adj)*4,(#credits_text[3]+#yol_adj)*4
if(w2>w1)w1=w2
local width=(w1)
local left_align=64-(width*0.5)
rrect(64-(width*0.5)-2+_x,_y1-1,2+width,16,1)
rrect(64-(width*0.5)-2+_x,_y1-2,2+width,16,7)
local align=hcentre(credits_text[2]..lou_adj)+_x
print(credits_text[2],align,_y1,_c1)
print(lou_adj,align+(#credits_text[2]*4),_y1,_c2)
local align=hcentre(credits_text[3]..yol_adj)+_x
print(credits_text[3],align,_y2,_c1)
print(yol_adj,align+(#credits_text[3]*4),_y2,_c2)
--twitter tags
text_bold2("@0Xffb3",3+_x,108+_y,7,5)
text_bold2("@YOOLWOOCLE_",3+_x,117+_y,7,5)
end
function draw_conveyor()
local _y=105
for i=0,10 do
local _x=-20+(i*16)+(conveyor_time\conv_mod)%16
sspr(0,64,16,16,_x,_y)
end
line(-5,_y+15,130,_y+15,3)
line(-5,_y+17,130,_y+17,3)
end
function draw_cursor()
local _x,_y=dx(c.dobj),dy(c.dobj)
sspr(48,0,16,15,_x,_y)
end
function draw_report()
local _x,_y=dx(report.dobj),dy(report.dobj)
local _w,_h=80,100
rectfill(_x,_y,_x+_w,_y+_h,7)
rect(_x,_y,_x+_w,_y+_h,5)
text_bold2("SELF-REPORT CARD",_x+3,_y+2,7,1)
line(_x+3,_y+10,_x+_w-3,_y+10,1)
rect(_x+60,_y+22,_x+75,_y+37,6) --sticker area
text_bold("TODAY I AM FEELING",_x+3,_y+13,7,1)
text_bold(" - "..report.adj1,_x+3,_y+20,7,5)
if(report.sticker)spr(report.sticker_spr,_x+60+report.sticker_ox,_y+22+report.sticker_oy,2,2)
line(_x+3,_y+29,_x+_w-25,_y+29,1)
text_bold("TODAY I...",_x+3,_y+35,7,1)
local i=0
for text in all(split"TRIED MY BEST,HELPED TIDY,USED MY MANNERS,ATE ALL MY FOOD,STAYED FOCUSED") do
text_bold("[] "..text,_x+5,_y+43+i*8,7,5)
i+=1
end
for i=1,5 do
if(report.cur_mark>=i)spr(21,_x+5,_y+41+((i-1)*8))
end
local y_cont=43+(i*8)+2
line(_x+3,_y+y_cont,_x+_w-3,_y+y_cont,1)
text_bold2("SIGNED:",_x+4,_y+_h-10,7,1)
line(_x+35,_y+_h-5,_x+_w-5,_y+_h-5,6)
local sx,sy,sw,sh=39,21,41,8
if(report.signature)sspr(sx,sy,sw,sh,_x+35,_y+_h-12)
line(_x,_y+_h+1,_x+_w,_y+_h+1,0)
end
function draw_ingredients()
for ingredient in all(g_ingredients) do
local _x,_y=dx(ingredient.dobj), dy(ingredient.dobj)
spr(ingredient.obj._s, _x, _y, 2, 2)
end
end
function selected_effects()
local _y=dy(cur_fx_dobj.dobj)
local ingredient=g_ingredients[c.sel_index]
for i=1,#ingredient.obj.effects do
local fx=ingredient.obj.effects_modified[i]
rrect(2,_y-1+i*13,55,15,1)
print(fx,4,_y+i*13,4)
end
end
function animate_score_mode()
if(c.mode!="pot")return
if(time_since_last>30)anim_to_point(potion,30,potion.target_y)
--when the secondary text is finished writing
local text_finish_time=#text_parse*parse_speed+120
for i=1,3 do
if time_since_last==30+text_finish_time+i*23 then
shake=0.07
ticks[i]=true
sfx(59)
end
end
if(time_since_last>text_finish_time+250)return_to_belt()
end
function draw_effects()
local _x,_y=61,39
local _w,_h=62,60
rrect(_x,_y,_w,_h,3)
text_wave("effects",_x+5,_y+2,7,5,7)
line(_x+4,_y+10,_x+_w-4,_y+10,5)
rectfill(_x+(_w*0.5)-2,_y+8,_x+(_w*0.5)+2,_y+12,3)
line(_x+(_w*0.5)-1,_y+11,_x+(_w*0.5)+1,_y+11,5)
line(_x+(_w*0.5),_y+8,_x+(_w*0.5),_y+12,5)
-- local default_text="--EMPTY SLOT-- \n"
local default_text="- \n"
for i=0,2 do
local text=pot.ingr[i+1] or default_text
local col=1
if(pot.ingr[i+1]!=nil)col=7
print(text,_x+4,_y+14+i*14,col)
end
end
function draw_pot()
local _x,_y=3,80
sspr(96,64,26,46,_x,_y)
sspr(96,64,26,46,_x+26,_y,26,46,true)
end
-->8
--recipes
-->8
-- recipies 2
function generate_ingredient()
local sprite = rnd{64,96} + flr(rnd(8))*2
local gen_ingr={
_s=sprite,
effects={},
effects_modified={},
}
local num_effects=2+flr(rnd(2))
for i=0,num_effects do
local effect=rnd(all_effects)
if(flr(rnd(20))==0)then