forked from stevelavietes/pico8carts
-
Notifications
You must be signed in to change notification settings - Fork 3
/
picotrisattack.p8
2635 lines (2460 loc) · 87.3 KB
/
picotrisattack.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 8
__lua__
-- competitive block matching
cartdata("picotris_attack_high_scores")
alphabet = "abcdefghijklmnopqrstuvwxyz "
-- function clear_scores()
-- for i=0,63 do
-- dset(i, 1)
-- end
-- end
function _init()
-- clear_scores()
-- globals struct
-- @notes: i think the idea of the background is better than its current
-- implementation
-- maybe we can remove the bar on the left and the tophold indicators
-- in favor of putting animation in the bg?
g_tick = 0
g_cs = {} --camera stack
g_ct = 0 --controllers
g_ctl = 0 --last controllers
g_lv = {0,0} --p1/p2 game level
--previously per-board
--global for tokens savings
g_h = 12 --board height
g_w = 6 --board width
g_hp = g_h*9 --height/pixels
g_wp = g_w*9 --width/pixels
--general objects
g_go = {
make_trans(
function()
addggo(make_title())
end
)
}
--disable sound
-- memset(0x3200,0,0x4300-0x3200)
end
function _update()
-- naturally g_tick wraps to
-- neg int max instead of 0
g_tick = max(0,g_tick+1)
-- current/last controller
g_ctl = g_ct
g_ct = btn()
-- top-level objects
update_gobjs(g_go)
end
function _draw()
cls()
rectfill(0,0,127,127,5)
draw_gobjs(g_go)
-- print('cpu:'..
-- (flr(stat(1)*100))..'%',100,0,
-- 7)
end
--
function make_row(
w, -- row width
e, -- row is empty or not
nt,-- number of tile types
ra,-- row above (check match)
raa)--row above row above
local r = {}
for j = 1, w do
r[j] = {}
local n=0
if not e then
n = flr(rnd(nt) + 1)
local tries=0
while (j > 2 and (n == r[j-1].t
and n == r[j-2].t)
or (ra
and raa
and
(raa[j].t == n
and ra[j].t == n)))
and
tries < nt do
n += 1
tries += 1
if n > nt then
n = 1
end
end
end
r[j].t = n
end
return r
end
function make_board(
x, -- x position
y, -- y position
p, -- player
v, -- number of visible lines
nt)-- number of tile types
local b = {
draw=draw_board,
update=update_board,
start=function(b)
b.st = 3 -- countdown to start
add(b.go,make_cnt(b))
--b.ri = nil
--if b.ob then
b.mtlidx=1
b.mtlcnt=0
--end
end
,
nt=nt, --tile types
t={}, -- a list of rows
-- cursor position (0 indexed)
cx=2, --flr(w/2)-1
cy=8, --h-4
x=x,
y=y,
noshake_x=x,
noshake_y=y,
p=p, -- player (input)
o=4, -- rise offset
r=0.025, -- rise rate
mc=0, --match count
f={}, -- tiles to fall
go={}, -- general objects
gq={}, -- queued garbage
st=0, -- board state
lc=0, -- lines cleared
dropcount=0, --weight of
--garbage dropped
--this cycle
shake_start=g_tick,
shake_time=5,
shake_amount=10,
}
for i = g_h,1,-1 do
local e,r2,r3 = g_h-i > v,
b.t[i+1],
b.t[i+2]
b.t[i] = make_row(
g_w,e,b.nt,r2,r3)
end
-- additional fields
--b.s = nil -- tiles to swap
--b.ri = nil -- time since rise
-- board state enum
-- 0 -- playing
-- 1 -- lose
-- 2 -- win
-- 3 -- countdown to start
return b
end
--function start_board(b)
-- b.st = 3 -- countdown to start
-- add(b.go,make_cnt(b))
-- b.ri = nil
-- --if b.ob then
-- b.mtlidx=1
-- b.mtlcnt=0
-- --end
--end
function input_cursor(b)
local m,p =
false,
b.p
if btnp(0, p) then
if b.cx > 0 then
b.cx -= 1
m = true
end
end
if btnp(1, p) then
if b.cx < g_w - 2 then
b.cx += 1
m = true
end
end
if btnp(2, p) then
if b.cy > 0 then
b.cy -= 1
m = true
end
end
if btnp(3, p) then
if b.cy < g_h - 2 then
b.cy += 1
m = true
end
end
if m then
sfx(0)
end
end
function input_board(b)
input_cursor(b)
if btnn(5,b.p) and b.st==0 then
local x,y =
b.cx+1,
b.cy+1
local t1,t2 =
b.t[y][x],
b.t[y][x+1]
if not busy(t1, t2) and
(t1.t>0 or t2.t>0) then
t1.s = g_tick
t1.ss = 1
t2.s = g_tick
t2.ss = -1
b.s = {t1, t2}
sfx(1)
end
end
end
function end_game(b, single_player)
for t in all(b.s or {}) do
t.s=nil
t.ss=nil
end
if b.st==1 then
b.et=g_tick
sfx(6)
else
g_wins[b.p+1]+=1
end
b.s=nil
b.tophold=nil
b.hd=nil
local np=1
make_shake(b, 10, 20)
if b.ob then
np=2
end
local score = nil
if single_player then
score = b.sb.s
addggo(make_enter_score(score))
else
addggo(make_retry(np))
end
--(g_wp)/2-16,(g_hp)/2-16))
--hard-wire for tokens
add(b.go, make_winlose(b.st==2, 11, 38, score))
end
function load_high_score_table()
local highscore_table = {}
-- initials
for entry=0, 19, 4 do
local initials = ""
for i=0, 2 do
local current = dget(entry+i)
initials = initials .. sub(alphabet, current, current)
end
local score = dget(entry+3)
add(highscore_table, {initials, score})
end
return highscore_table
end
function digits(num)
local result = 1
while (num/10 >= 1) do
result += 1
num = flr(num/10)
end
return result
end
function make_high_score_list(scores)
if not scores then
scores = load_high_score_table()
end
return {
x=40,
y=20,
ndigits=digits(scores[1][2]),
scores=scores,
draw=function(t)
cursor(0, 0)
rectfill(0,0, 2+(8+t.ndigits)*4+3, 2+6*5-1, 5)
rectfill(-1,-1, 3+(8+t.ndigits)*4, 2+6*5-2, 6)
rect(-2,-2, 2+(8+t.ndigits)*4+2, 2+6*5-2, 0)
for i, stuff in pairs(scores) do
if i == 1 then
color(8)
else
color(0)
end
print("["..i.."] "..stuff[1]..": "..stuff[2])
end
end
}
end
function make_enter_score(score)
-- load the previous high scores
local scores = load_high_score_table()
local new_score_loc = find_new_score_loc(scores, score)
-- assume that score saved to table is sorted
if not new_score_loc then
-- show high score list
addggo(make_retry(np))
addggo(make_high_score_list(scores))
return
end
return {
x=0,
y=0,
initials = {1, 1, 1},
initial_str="aaa",
current_letter=0,
update=function(t)
if btnn(0) then
t.current_letter = max(t.current_letter - 1, 0)
end
if btnn(1) then
t.current_letter = min(t.current_letter + 1, 3)
end
-- down
if t.current_letter < 3 then
if btnn(3) then
t.initials[t.current_letter + 1] = min(
27,
t.initials[t.current_letter+1] + 1
)
if t.initials[t.current_letter + 1] == 27 then
t.initials[t.current_letter + 1] = 1
end
end
-- up
if btnn(2) then
t.initials[t.current_letter + 1] = max(
0,
t.initials[t.current_letter+1] - 1
)
if t.initials[t.current_letter + 1] == 0 then
t.initials[t.current_letter + 1] = 26
end
end
else
if btnn(4) or btnn(5) then
save_score(scores, new_score_loc, t.initials, score)
addggo(make_retry())
addggo(make_high_score_list())
del(g_go, t)
end
end
t.initial_str = ""
for i=1,3 do
t.initial_str = (t.initial_str..sub(alphabet, t.initials[i], t.initials[i]))
end
end,
draw=function(t)
-- background
rect(45,79,90,96,0)
rectfill(46,80,89,95,5)
print(t.initial_str,55,82,12)
print("high score!", 47, 90, 12)
if t.current_letter == 3 then
pal(1, 11)
end
spr(225, 67, 80, 2, 2)
if t.current_letter == 3 then
pal(1, 1)
end
-- cursor
if t.current_letter < 3 then
rect(54+4*t.current_letter, 81, 54+4*t.current_letter+4, 87, 11)
end
end
}
end
function offset_board(b)
if b.st ~= 0 then return end
--pause while matching
if b.mc>0 then
if b.tophold then
b.tophold+=1
end
if b.hd then
b.hd+=1
end
end
if b.hd then
if b.hd > 0 then
b.hd-=1
if b.tophold then
b.tophold=g_tick
end
else
b.hd=nil
--for no speed-up during
--hold
--b.ri=g_tick
end
end
if not b.ri then
b.ri=g_tick
end
if b.st == 0 and elapsed(b.ri) > 30 then
b.ri=g_tick
b.r+=0.001
end
if btn(4,b.p) then
b.o+=1
elseif not b.hd
and b.mc==0 then
b.o+=b.r
end
if b.o >= 9 then
local r = b.t[1]
for i=1,#r do
-- lose condition
if r[i].t > 0 then
if b.tophold then
b.o=9
if elapsed(b.tophold) > 60 then
b.st=1
if b.ob then
b.ob.st=2
end_game(b)
end_game(b.ob)
else
end_game(b, true)
end
end
else
b.tophold=g_tick
end
return
end
end
b.tophold=nil
b.o=0
del(b.t, b.t[1])
add(b.t, make_row(g_w,false,
b.nt))
b.lc+=1
--if b.mtlidx then
b.mtlcnt+=1
if b.mtlcnt >=
g_nxtmtl[b.mtlidx] then
b.mtlidx+=1
if b.mtlidx > #g_nxtmtl
then
b.mtlidx=1
end
b.mtlcnt=0
b.t[g_h][
flr(rnd(g_w))+1].t=7
end
--end
if b.cy>0 then
b.cy-=1
end
sfx(3)
end
end
function update_board(b)
if b.st==0 then
local gb=b.gq[1]
if gb and
elapsed(gb[3])>40 then
local x=garb_fits(b,gb[1],
gb[2])
if x then
add_garb(b,x,0,gb[1],gb[2],
gb[4])
del(b.gq,gb)
end
end
offset_board(b)
end
if b.st==0 or b.st==3 then
input_board(b)
end
if b.st==0 then
scan_board(b)
end
apply_shake(b, 9)
update_gobjs(b.go)
end
function garb_fits(b,w,h)
local sx=flr(rnd(g_w-w+0.99))
for x=sx+1,sx+w do
for y=1,h do
local t=b.t[y][x]
if busy(t) or t.t>0 then
return nil
end
end
end
return sx
end
function busy(...)
for t in all({...}) do
if t.m or t.s or t.f or t.g
then
return true
end
end
return false
end
function swapt(t,t2)
local tmp = {}
for k,v in pairs(t) do
tmp[k] = v
t[k] = nil
end
for k,v in pairs(t2) do
t[k] = v
t2[k] = nil
end
for k,v in pairs(tmp) do
t2[k] = v
end
end
function update_swap(b)
if (not b.s) return
local t,t2 = b.s[1],b.s[2]
if elapsed(t.s) > 1 then
t.s = nil
t.ss = nil
t2.s = nil
t2.ss = nil
b.s = nil
swapt(t, t2)
end
end
function set_falling(b, t, t2)
t.s = g_tick
t.f = true
t2.f= true
add(b.f, {t,t2})
end
function update_fall(b)
for x=1,g_w do
for y=g_h-1,1,-1 do
local t=b.t[y][x]
if (t.g
and t.g[1] ==0
and t.g[2] ==0) then
-- if it isn't already falling or matching
if (not t.f and not t.gm) then
update_fall_gb(b,x,y)
end
elseif y<g_h and t.t>0 then
local t2=b.t[y+1][x]
if t2.t==0 and
not busy(t,t2) then
-- mark for falling
set_falling(b, t, t2)
-- blocks above fall too
fall_above(x,y,t,b)
end
end
end
end
--if (not b.f) return
for f_s in all(b.f) do
local t,t2 = f_s[1],f_s[2]
--xxx: can't find what's
--causing non-falling entries
--in b.f, for now, ignore
--and remove
if not t.s then
del(b.f,f_s)
--cls()
--print(t.f)
--print(t.g)
--print(t.gm)
--stop()
elseif elapsed(t.s) > 0 then
-- execute the fall
t.s = nil
t.ss = nil
t2.s = nil
t2.ss = nil
t.f = false
t2.f = false
swapt(t, t2)
del(b.f, f_s)
end
end
end
function update_fall_gb(b,x,y)
local t = b.t[y][x]
local should_fall = true
local lastgx=t.g[3]+x-1
local lastgy=t.g[4]+y-1
local have_cleared=false
for xg=x,lastgx do
local t2 = b.t[lastgy+1][xg]
if t2.t~=0 and not t2.f then
should_fall = false
break
end
end
if should_fall then
for xg=x,lastgx do
for yg=lastgy,y,-1 do
local tg1=b.t[yg][xg]
local tg2=b.t[yg+1][xg]
set_falling(b, tg1, tg2)
if yg==y then
fall_above(xg,y,tg1,b)
end
end
end
else
-- first garbage hit
if t.firsthit then
t.firsthit = nil
--sfx(8)
--todo, weight by width
b.dropcount = b.dropcount+1
end
end
end
function fall_above(x,y,t,b)
for a=y-1,1,-1 do
local a_t = b.t[a][x]
if a_t.g and not a_t.f then
local root_gb_x = x-a_t.g[1]
local root_gb_y = a-a_t.g[2]
local root_block = b.t[root_gb_y][root_gb_x]
if not root_block.gm then
update_fall_gb(b, root_gb_x, root_gb_y)
end
break
end
if busy(a_t) then
break
end
set_falling(b, a_t, t)
t = a_t
end
end
function above_solid(b,x,y)
--brute force test prevent
--mid-fall matches.
--todo:optimize
for i=y+1,g_h-1 do
if b.t[i][x].t==0 then
return false
end
end
return true
end
function clr_match(b,x,y)
local t=b.t[y][x]
t.m=nil
t.t=0
t.e=nil
--update chain count above
local ch=t.ch
if not ch then
ch=2
else
t.ch=nil
ch+=1
end
for i=y-1,1,-1 do
local t2=b.t[i][x]
if t2.t>0 and
not busy(t2) then
if t2.ch then
t2.ch=max(ch,t2.ch)
else
t2.ch=ch
end
end
end
b.mc-=1
end
function reset_chain(b)
for x=1,g_w do
local tt = b.t[g_h-1][x]
if not busy(tt) then
tt.ch=nil
end
for y=g_h-2,1,-1 do
local t=b.t[y][x]
if not busy(t) and t.ch then
if (tt.t>0 and
not busy(tt)) and
not tt.ch
then
t.ch=nil
end
end
tt=t
end
end
end
function match_garb(b,x,y,ch,gbt)
local t=b.t[y][x]
if not t.g or t.gm then
return
end
--metal vs regular
if gbt and t.g[5] ~= gbt then
return
end
gbt=t.g[5]
x-=t.g[1]
y-=t.g[2]
local xe=x+t.g[3]-1
local ye=y+t.g[4]-1
local w=t.g[3]
for yy=y,ye do
local r=make_row(
w,false,b.nt)
for xx=x,xe do
t=b.t[yy][xx]
--charge preservation
t.ch=max(ch,t.ch or 1)
t.t=r[xx-x+1].t
t.gm=g_tick
--match top and bottom
if yy==y and yy>1 then
match_garb(b,xx,yy-1,ch,gbt)
end
if yy==ye and yy<g_h-1 then
match_garb(b,xx,yy+1,ch,gbt)
end
-- match left and right
if xx==x and xx > 1 then
match_garb(b,xx-1,yy,ch,gbt)
end
if xx==xe and xx < g_w-1 then
match_garb(b,xx+1,yy,ch,gbt)
end
--
end
end
end
function scan_board(b)
local ms = {}
update_fall(b)
update_swap(b)
-- act upon the accumulated
-- first drop of the garbage
if b.dropcount == 1 then
b.dropcount = 0
-- make_shake(b, 5, 8)
end
for h = 1, g_h do
local r = b.t[h]
for w = 1,g_w do
local t = r[w]
if t.m then
if elapsed(t.m) > 30 then
clr_match(b,w,h)
end
end
if t.gm and
elapsed(t.gm)>60 then
t.gm=nil
t.g=nil
end
if t.t > 0 and
not busy(t) and
above_solid(b,w,h) then
if w < g_w-1 then
local wc = 1
for i=(w+1),g_w do
if t.t == r[i].t and
not busy(r[i]) and
above_solid(b,i,h) then
wc+=1
else
break
end
end
if wc > 2 then
for i=w,w+(wc-1) do
add(ms,{r[i],i,h})
end
end
end
if h < g_h-2 then
local hc = 1
for i=(h+1),g_h-1 do
if t.t == b.t[i][w].t and
not busy(b.t[i][w]) then
hc+=1
else
break
end
end
if hc > 2 then
for i=h,h+(hc-1) do
add(ms,{b.t[i][w],w,i})
end
end
end
end
end
end
--collase to unique matches
local mc=0
local mtlc=0 --mtl count
local um={}
local ch=1
local mm={g_w,0,g_h,0}
for m in all(ms) do
local t=m[1]
local x=m[2]
local y=m[3]
mm[1]=min(x,mm[1])
mm[2]=max(x,mm[2])
mm[3]=min(y,mm[3])
mm[4]=max(y,mm[4])
if not um[t] then
um[t]={x,y}
t.m=g_tick
if t.t==7 then
mtlc+=1
else
mc+=1
end
t.e=30-((mc*3)%15)
if t.ch then
ch=max(ch,t.ch)
end
end
end
local mx=mm[1]+(mm[2]-mm[1])/2
local my=mm[3]+(mm[4]-mm[3])/2-1
b.mc+=mc+mtlc
if mc>0 then
sfx(2)
end
--check for adjacent garbage
for t,xy in pairs(um) do
local x,y,chp =
xy[1],
xy[2],
ch+1
if x>1 then
match_garb(b,x-1,y,chp)
end
if x<g_w-1 then
match_garb(b,x+1,y,chp)
end
if y>1 then
match_garb(b,x,y-1,chp)
end
if y<g_h-1 then
match_garb(b,x,y+1,chp)
end
end
if ch>1 then
addggo(make_bubble(
max(0,b.x+(mx-1)*9-17),
b.y+my*9,ch..'x',true))
incr_hold(b,ch*10) --tune
if ch > 2 then
sfx(40+ch-2)
b.trumpets = true
make_shake(b, 7, 5)
end
end
if mc>3 then
incr_hold(b,mc*12) --todo tune
addggo(make_bubble(
min(112,b.x+mx*9),
b.y+my*9-5,mc,false))
end
--target board, could be score
local tb = b.ob or b.sb
if mtlc>2 then
incr_hold(b,mtlc*12) --todo tune
send_garb(
b.x+mx*9,
b.y+my*9,
tb,
{1,(mtlc-2)*6+1,g_tick,1},
g_tick)
make_shake(b, 7, 5)
end
if tb and
(ch>1 or mc>3) then
send_garb(
b.x+mx*9,
b.y+my*9,
tb,
{ch,mc,g_tick,0},
g_tick)
if not b.trumpets or b.trumpets == false then
make_shake(b, 5, 5)
end
sfx(10)
end
reset_chain(b)
end
function garb_size(gb)
local r={}
local sum=(gb[2]-1)*gb[1]
local left=sum%6
if sum-left>0 then
add(r,{6,flr(sum/6),gb[3],gb[4]})
end
if left>2 then
add(r,{left,1,gb[3],gb[4]})
end
return r
end
function send_garb(sx,sy,b,gb,e)
addggo({
sx=sx,sy=sy,b=b,gb=gb,e=e,
update=function(t,s)
if elapsed(t.e)>15 then
for gb in all(garb_size(t.gb)) do
add(t.b.gq,gb)
end
del(s,t)
end
end,
draw=function(t)
local v=elapsed(t.e)/15
local v2=v^3
palt(2,true)