-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgame.js
More file actions
4305 lines (3763 loc) · 168 KB
/
game.js
File metadata and controls
4305 lines (3763 loc) · 168 KB
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
// --- Inline Script Code from index.html ---
var orientation = 'landscape' ;
var aspect = '>16x9' ;
var graphics = "M1";
var ms_libs = ["matterjs"] ;
window.skip_service_worker = true;
window.exported_project = true;
window.ms_use_server = false ;
window.orientation = orientation;
window.aspect = aspect;
window.ms_libs = ms_libs;
window.fonts = ["BitCell","Edunline","EnterCommand","Pixellari","Pixolde","PressStart2P","RetroGaming","Romulus"];
var resources = {
"images": [{
"file": "assets.png",
"version": 4,
"size": 31596,
"properties": {"frames": 1, "fps": 5}
}, {"file": "bunker.png", "version": 8, "size": 224, "properties": {"frames": 1, "fps": 5}}, {
"file": "cursor.png",
"version": 18,
"size": 3696,
"properties": {"frames": 7, "fps": 6}
}, {
"file": "damage_01.png",
"version": 18,
"size": 176,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "damage_02.png",
"version": 15,
"size": 218,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "dpad.png",
"version": 1,
"size": 2155,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "enemy_explo.png",
"version": 4,
"size": 1455395,
"properties": {"frames": 64, "fps": 30}
}, {
"file": "enemystart.png",
"version": 10,
"size": 128,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "fire_icon.png",
"version": 1,
"size": 774,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "fire_icon2.png",
"version": 1,
"size": 2031,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "firework.png",
"version": 4,
"size": 791281,
"properties": {"frames": 30, "fps": 29}
}, {
"file": "gamepad_icon.png",
"version": 1,
"size": 2295,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "goalstar.png",
"version": 28,
"size": 392,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "grenade.png",
"version": 1,
"size": 18463,
"properties": {"frames": 24, "fps": 25}
}, {
"file": "gun_a_01.png",
"version": 3,
"size": 1764,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_a_02.png",
"version": 2,
"size": 1608,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_a_03.png",
"version": 2,
"size": 1353,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_a_04.png",
"version": 2,
"size": 1607,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_a_05.png",
"version": 2,
"size": 1383,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_a_06.png",
"version": 2,
"size": 1501,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_a_07.png",
"version": 2,
"size": 1775,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_a_08.png",
"version": 2,
"size": 1700,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_01.png",
"version": 2,
"size": 1782,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_02.png",
"version": 2,
"size": 1613,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_03.png",
"version": 2,
"size": 1363,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_04.png",
"version": 2,
"size": 1588,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_05.png",
"version": 2,
"size": 1430,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_06.png",
"version": 2,
"size": 1498,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_07.png",
"version": 2,
"size": 1804,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_c_08.png",
"version": 2,
"size": 1729,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_01.png",
"version": 2,
"size": 1764,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_02.png",
"version": 2,
"size": 1621,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_03.png",
"version": 2,
"size": 1364,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_04.png",
"version": 2,
"size": 1592,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_05.png",
"version": 2,
"size": 1417,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_06.png",
"version": 2,
"size": 1501,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_07.png",
"version": 2,
"size": 1767,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "gun_d_08.png",
"version": 2,
"size": 1709,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "heart.png",
"version": 9,
"size": 121,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "heavy_shell.png",
"version": 2,
"size": 808,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_01.png",
"version": 1,
"size": 3377,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_02.png",
"version": 2,
"size": 4449,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_03.png",
"version": 2,
"size": 3287,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_04.png",
"version": 2,
"size": 2610,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_05.png",
"version": 2,
"size": 3367,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_06.png",
"version": 2,
"size": 3945,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_07.png",
"version": 2,
"size": 2667,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_a_08.png",
"version": 2,
"size": 2425,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_01.png",
"version": 3,
"size": 3371,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_02.png",
"version": 2,
"size": 4474,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_03.png",
"version": 2,
"size": 3252,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_04.png",
"version": 2,
"size": 2621,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_05.png",
"version": 2,
"size": 3372,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_06.png",
"version": 2,
"size": 3874,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_07.png",
"version": 2,
"size": 2680,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_c_08.png",
"version": 2,
"size": 2482,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_01.png",
"version": 2,
"size": 3401,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_02.png",
"version": 2,
"size": 4444,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_03.png",
"version": 2,
"size": 3239,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_04.png",
"version": 2,
"size": 2603,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_05.png",
"version": 2,
"size": 3397,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_06.png",
"version": 2,
"size": 3903,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_07.png",
"version": 2,
"size": 2675,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "hull_d_08.png",
"version": 2,
"size": 2448,
"properties": {"frames": 1, "fps": 5}
}, {"file": "icon.png", "version": 2, "size": 71226, "properties": {"frames": 1, "fps": 5}}, {
"file": "icon256.png",
"version": 1,
"size": 71226,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "keyboard_icon.png",
"version": 1,
"size": 1896,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "light_shell.png",
"version": 1,
"size": 626,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "map_explo.png",
"version": 3,
"size": 957371,
"properties": {"frames": 64, "fps": 60}
}, {
"file": "menu_icon.png",
"version": 1,
"size": 489,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "muzzle_explo.png",
"version": 2,
"size": 1048742,
"properties": {"frames": 64, "fps": 60}
}, {"file": "ocean.png", "version": 5, "size": 5063, "properties": {"frames": 16, "fps": 9}}, {
"file": "plasma.png",
"version": 2,
"size": 390,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "player1start.png",
"version": 51,
"size": 136,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "player2start.png",
"version": 1,
"size": 180,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "poof.png",
"version": 9,
"size": 360492,
"properties": {"frames": 30, "fps": 25}
}, {"file": "poster.png", "version": 1, "size": 416652, "properties": {}}, {
"file": "projectile_explo.png",
"version": 3,
"size": 956043,
"properties": {"frames": 64, "fps": 60}
}, {
"file": "tank_icon.png",
"version": 1,
"size": 121,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "targetexplosion.png",
"version": 5,
"size": 1192490,
"properties": {"frames": 64, "fps": 30}
}, {
"file": "targetpoint.png",
"version": 1,
"size": 127,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "touchscreen_icon.png",
"version": 4,
"size": 1520,
"properties": {"frames": 1, "fps": 5}
}, {
"file": "track_01.png",
"version": 5,
"size": 1911,
"properties": {"frames": 2, "fps": 10}
}, {
"file": "track_02.png",
"version": 4,
"size": 2645,
"properties": {"frames": 2, "fps": 10}
}, {
"file": "track_03.png",
"version": 5,
"size": 2063,
"properties": {"frames": 2, "fps": 10}
}, {
"file": "track_04.png",
"version": 4,
"size": 1834,
"properties": {"frames": 2, "fps": 10}
}, {"file": "upgrade.png", "version": 36, "size": 680, "properties": {"frames": 4, "fps": 5}}, {
"file": "vines.png",
"version": 1,
"size": 427,
"properties": {"frames": 1, "fps": 5}
}, {"file": "wall.png", "version": 45, "size": 223, "properties": {"frames": 1, "fps": 5}}],
"assets": [],
"maps": {
"bg_intermission": "{\"width\":32,\"height\":20,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"wall\"],\"data\":[1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1]}",
"bg_mainmenu": "{\"width\":32,\"height\":20,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"assets:7,3\",\"assets:8,3\",\"assets:2,3\",\"assets:3,3\",\"assets:4,3\",\"wall\",\"assets:7,2\",\"assets:8,2\",\"assets:2,2\",\"assets:3,2\",\"assets:4,2\",\"assets:6,3\",\"vines\",\"assets:11,9\",\"assets:5,23\",\"assets:6,23\",\"assets:7,23\",\"assets:8,23\",\"assets:4,23\",\"assets:5,22\",\"assets:6,22\",\"assets:7,22\",\"assets:8,22\",\"assets:4,22\",\"assets:5,21\",\"assets:6,21\",\"assets:7,21\",\"assets:8,21\",\"assets:4,21\",\"assets:5,20\",\"assets:6,20\",\"assets:7,20\",\"assets:8,20\",\"assets:4,20\",\"assets:5,19\",\"assets:6,19\",\"assets:7,19\",\"assets:8,19\"],\"data\":[1,2,3,4,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,3,4,5,1,2,7,8,9,10,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,9,10,11,7,8,0,0,0,0,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,4,0,0,0,0,12,12,12,12,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,12,12,12,12,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,12,12,12,12,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,12,12,12,12,13,13,13,13,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,13,13,13,13,13,13,13,13,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,13,13,13,13,14,14,14,14,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,14,14,14,14,15,16,17,18,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,19,15,16,17,20,21,22,23,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,0,24,20,21,22,25,26,27,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,29,25,26,27,30,31,32,33,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,34,30,31,32,35,36,37,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,36,37,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,12,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,12,12,12,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,0,0,1,2,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,0,1,2,7,8,0,12,0,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,0,12,0,7,8]}",
"bg_pause": "{\"width\":32,\"height\":20,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"wall\"],\"data\":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}",
"level_01": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"player1start\",\"targetpoint\",\"player2start\",\"assets:6,3\",\"enemystart\"],\"data\":[0,0,0,0,0,0,1,0,0,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,4,4,4,0,4,4,4,4,4,4,4,4,4,4,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,4,0,4,4,4,4,4,4,0,4,0,4,4,4,4,4,4,0,0,0,4,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,0,4,4,4,4,4,4,4,4,0,4,4,4,4,4,5,0,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,5]}",
"level_02": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"assets:4,16\",\"assets:5,16\",\"player1start\",\"targetpoint\",\"player2start\",\"assets:1,16\",\"assets:2,16\",\"assets:4,15\",\"assets:2,15\",\"assets:12,9\",\"assets:13,9\",\"assets:12,8\",\"assets:13,8\",\"assets:3,3\",\"assets:4,4\",\"assets:1,18\",\"assets:3,4\",\"assets:7,23\",\"assets:1,12\",\"assets:5,2\",\"assets:2,0\",\"assets:3,0\",\"assets:4,0\",\"assets:2,12\",\"assets:7,22\",\"assets:8,22\",\"assets:1,2\",\"assets:4,20\",\"assets:8,0\",\"assets:3,15\",\"assets:7,19\",\"assets:7,3\",\"assets:8,3\",\"assets:6,3\",\"assets:7,2\",\"assets:8,2\",\"enemystart\"],\"data\":[1,2,0,0,0,0,3,0,0,4,0,0,5,0,0,0,0,0,6,7,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0,0,10,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,13,14,15,0,16,17,17,15,0,10,11,18,0,0,19,20,0,0,0,21,22,22,23,0,21,24,14,20,0,12,13,25,26,0,27,20,0,0,0,0,0,0,0,0,0,28,22,2,0,6,29,30,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,33,0,34,34,34,0,32,33,32,33,32,33,0,34,34,34,0,32,33,35,36,0,0,34,0,0,35,36,35,36,35,36,0,0,34,0,0,35,36,0,0,0,0,34,0,0,0,0,0,0,0,0,0,0,34,0,0,0,0,37,0,0,0,34,0,0,0,0,37,0,0,0,0,0,34,0,0,0,37]}",
"level_03": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"player1start\",\"targetpoint\",\"player2start\",\"assets:6,3\",\"assets:5,23\",\"assets:6,23\",\"assets:7,23\",\"assets:4,22\",\"assets:5,22\",\"assets:6,22\",\"assets:7,22\",\"assets:8,22\",\"assets:4,21\",\"assets:5,21\",\"assets:6,21\",\"assets:7,21\",\"assets:8,21\",\"assets:4,20\",\"assets:5,20\",\"assets:6,20\",\"assets:7,20\",\"assets:8,20\",\"assets:5,19\",\"assets:6,19\",\"assets:7,19\",\"enemystart\",\"assets:3,3\"],\"data\":[0,0,0,0,0,0,1,0,0,2,0,0,3,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,4,4,4,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,7,0,0,0,4,4,0,4,4,0,4,4,4,0,0,0,0,8,9,10,11,12,0,0,4,4,0,0,0,0,4,4,4,4,4,0,0,13,14,15,16,17,0,0,4,4,4,0,4,4,4,4,4,0,0,0,0,18,19,20,21,22,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,23,24,25,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,0,0,0,4,4,4,4,4,4,4,0,0,26,0,4,27,27,27,27,4,0,26,0,4,27,27,27,27,27,4,0,26]}",
"level_04": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"enemystart\",\"assets:1,18\",\"assets:2,3\",\"player1start\",\"targetpoint\",\"assets:11,9\",\"assets:3,12\",\"assets:1,17\",\"assets:12,9\",\"assets:13,9\",\"assets:1,16\",\"assets:3,0\",\"assets:12,8\",\"assets:13,8\",\"assets:4,20\",\"assets:5,20\",\"player2start\",\"assets:6,3\",\"assets:5,19\",\"assets:5,18\",\"assets:7,3\",\"assets:8,3\",\"assets:7,2\",\"assets:8,2\",\"assets:1,1\",\"assets:5,1\",\"assets:9,0\"],\"data\":[1,0,0,0,0,0,0,0,0,0,0,0,0,2,3,0,4,0,0,5,0,0,0,6,6,6,0,7,7,0,0,0,0,8,3,0,0,0,0,0,0,0,9,10,6,0,0,11,7,7,0,0,0,11,12,0,0,0,0,0,0,0,13,14,0,0,0,0,15,16,7,0,0,0,0,0,0,0,0,17,0,0,0,18,18,0,0,0,0,19,7,0,0,0,2,20,0,0,0,0,0,0,21,22,18,0,0,3,3,0,0,0,0,0,8,3,0,3,3,3,0,0,23,24,0,0,0,3,3,0,0,0,0,0,25,26,0,27,27,27,0,0,21,22,21,22,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,23,24,23,24,0,0,0,7,7,7,0,0,0,18,18,18,0,0,0,0,0,0,0,0,0,0,7,7,7,7,7,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]}",
"level_05": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"player1start\",\"targetpoint\",\"player2start\",\"assets:7,3\",\"assets:8,3\",\"assets:7,2\",\"assets:8,2\",\"assets:4,19\",\"assets:6,3\",\"assets:4,18\",\"assets:5,18\",\"assets:4,17\",\"assets:5,17\",\"assets:5,23\",\"assets:4,16\",\"assets:5,16\",\"assets:4,22\",\"assets:5,22\",\"assets:4,15\",\"assets:4,21\",\"assets:5,21\",\"assets:4,20\",\"assets:5,20\",\"assets:12,9\",\"assets:13,9\",\"assets:5,19\",\"assets:12,8\",\"assets:13,8\",\"assets:3,3\",\"enemystart\",\"assets:1,1\",\"assets:2,1\",\"assets:4,1\",\"assets:5,1\"],\"data\":[1,0,0,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,4,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,7,8,0,0,0,0,0,0,0,0,0,0,9,9,9,0,0,4,5,0,0,10,11,0,0,0,0,0,0,0,0,0,9,0,0,0,0,6,7,0,0,12,13,0,0,0,0,0,0,0,0,0,9,0,0,4,5,0,0,0,14,15,16,0,0,4,5,0,0,0,0,0,0,0,0,6,7,0,0,17,18,19,0,0,0,6,7,0,0,9,0,0,0,0,0,0,0,0,0,20,21,0,0,4,5,0,0,0,0,9,0,0,0,0,0,0,0,0,0,22,23,0,0,6,7,0,0,9,9,9,0,0,24,25,0,0,0,0,0,0,26,4,5,0,0,0,0,0,0,0,0,0,27,28,0,29,29,0,0,0,0,6,7,0,0,0,0,0,0,0,0,0,0,0,30,31,32,30,33,34,30]}",
"level_06": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"assets:6,3\",\"player1start\",\"targetpoint\",\"player2start\",\"vines\",\"assets:7,3\",\"assets:8,3\",\"assets:12,9\",\"assets:13,9\",\"assets:7,2\",\"assets:8,2\",\"assets:12,8\",\"assets:13,8\",\"enemystart\"],\"data\":[1,0,0,0,0,0,2,0,0,3,0,0,4,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,5,5,5,0,0,0,0,5,5,1,1,1,1,1,1,1,1,1,1,1,5,5,6,7,8,9,6,7,5,1,1,1,1,1,1,1,1,1,1,1,5,5,10,11,12,13,10,11,5,1,1,1,1,1,1,1,1,1,1,1,5,5,5,0,0,0,0,5,5,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,14,0,0,0,14,0,0,0,14,0,0,0,1,1,1]}",
"level_07": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"assets:8,22\",\"player1start\",\"targetpoint\",\"player2start\",\"assets:7,3\",\"assets:8,3\",\"assets:6,3\",\"enemystart\",\"assets:8,21\",\"vines\",\"assets:7,2\",\"assets:8,2\",\"assets:8,20\",\"ocean\",\"assets:12,9\",\"assets:13,9\",\"assets:12,8\",\"assets:13,8\",\"assets:2,19\",\"assets:3,19\",\"assets:4,19\",\"assets:3,13\",\"assets:1,18\",\"assets:2,18\",\"assets:3,18\",\"assets:4,18\",\"assets:5,18\",\"assets:1,17\",\"assets:2,17\",\"assets:4,17\",\"assets:5,17\",\"assets:1,16\",\"assets:2,16\",\"assets:3,16\",\"assets:4,16\",\"assets:5,16\"],\"data\":[1,2,0,0,3,0,0,4,0,0,5,6,7,7,7,0,7,0,0,8,9,0,0,0,0,0,0,0,0,10,11,12,7,7,0,7,0,0,0,0,13,0,0,0,0,0,0,0,0,10,5,6,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,11,12,7,7,0,0,10,10,0,0,0,0,14,14,14,14,14,14,14,14,5,6,7,0,0,15,16,10,0,0,0,10,14,14,14,14,14,14,14,14,11,12,0,0,0,17,18,0,0,8,0,10,10,0,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,19,20,21,0,0,0,0,0,0,0,0,0,0,22,22,0,0,0,0,23,24,25,26,27,0,0,0,0,7,0,0,0,0,22,22,22,22,0,0,28,29,29,30,31,0,0,0,7,7,7,0,0,0,22,22,22,22,22,0,32,33,34,35,36,0,0,7,7,7,7,0,0,8]}",
"level_08": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"enemystart\",\"assets:12,9\",\"assets:13,9\",\"assets:6,3\",\"vines\",\"assets:12,8\",\"assets:13,8\",\"assets:7,3\",\"assets:8,3\",\"ocean\",\"assets:7,2\",\"assets:8,2\",\"assets:11,9\",\"player1start\",\"targetpoint\",\"player2start\"],\"data\":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,2,3,0,4,4,0,0,5,5,5,5,0,0,4,4,0,2,3,0,0,6,7,8,9,8,9,0,5,10,10,5,0,8,9,8,9,6,7,0,0,0,0,11,12,11,12,0,5,5,5,5,0,11,12,11,12,0,0,0,0,13,5,5,5,0,0,0,0,0,0,0,0,0,0,5,5,5,13,0,13,13,5,10,5,0,14,0,0,15,0,0,16,0,0,5,10,5,13,13,0,13,5,5,5,0,0,0,0,0,0,0,0,0,0,5,5,5,13,0,0,0,0,8,9,8,9,0,5,5,5,5,0,8,9,8,9,0,0,0,0,2,3,11,12,11,12,0,5,10,10,5,0,11,12,11,12,2,3,0,0,6,7,0,4,4,0,0,5,5,5,5,0,0,4,4,0,6,7,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]}",
"level_09": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"enemystart\",\"assets:6,3\",\"ocean\",\"assets:7,3\",\"assets:8,3\",\"assets:7,2\",\"assets:8,2\",\"assets:5,23\",\"assets:6,23\",\"assets:7,23\",\"assets:6,2\",\"assets:13,15\",\"assets:12,2\",\"vines\",\"assets:6,1\",\"assets:7,1\",\"assets:11,1\",\"assets:12,1\",\"assets:2,3\",\"assets:7,0\",\"assets:11,0\",\"player1start\",\"targetpoint\",\"player2start\"],\"data\":[1,0,0,2,2,0,0,0,1,0,0,0,1,0,0,2,2,0,0,1,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,2,2,0,0,2,2,2,2,2,2,2,0,2,2,0,0,0,0,0,0,2,2,0,0,0,2,3,3,2,0,0,0,2,2,0,0,0,0,0,4,5,4,5,0,0,0,2,2,0,0,0,4,5,4,5,0,0,0,0,6,7,6,7,0,0,0,0,0,0,0,0,6,7,6,7,0,0,0,0,8,9,9,10,0,2,0,2,2,2,0,0,0,0,0,0,0,0,0,0,11,12,12,13,0,2,2,2,0,2,2,0,0,0,14,14,14,0,0,0,15,16,17,18,0,0,0,0,0,0,0,0,0,19,19,19,14,0,0,0,0,20,21,0,0,0,0,0,0,0,0,0,0,19,14,14,14,0,0,0,0,0,0,0,22,0,0,23,0,0,24,0,0,0,0,0,0,0]}",
"level_10": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"enemystart\",\"vines\",\"assets:3,3\",\"assets:6,3\",\"assets:7,3\",\"assets:8,3\",\"assets:7,2\",\"assets:8,2\",\"player1start\",\"targetpoint\",\"player2start\"],\"data\":[1,0,1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,0,1,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2,2,2,0,0,2,2,2,2,2,0,0,2,2,2,2,0,0,1,0,2,3,3,3,0,0,0,0,0,0,0,3,3,2,2,2,0,1,0,0,2,3,3,0,0,0,0,4,0,0,0,3,3,0,0,2,0,0,0,0,0,3,2,2,2,5,6,0,5,6,0,0,3,3,0,2,0,0,1,0,0,0,0,0,0,7,8,0,7,8,0,0,0,3,0,2,0,1,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,2,5,6,0,0,0,0,0,0,0,5,6,0,0,2,0,0,1,0,2,0,7,8,0,0,0,0,0,0,0,7,8,0,0,0,0,1,0,0,2,2,2,0,9,0,0,10,0,0,11,0,0,0,2,2,2,2]}",
"level_11": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"ocean\",\"vines\",\"player1start\",\"targetpoint\",\"player2start\",\"assets:7,3\",\"assets:8,3\",\"assets:7,2\",\"assets:8,2\",\"assets:6,3\",\"assets:3,3\",\"enemystart\"],\"data\":[1,1,2,0,0,0,3,0,0,4,0,0,5,0,0,0,0,2,1,1,1,2,2,0,0,6,7,0,0,0,0,0,6,7,0,0,0,2,2,1,2,2,0,0,0,8,9,0,0,0,0,0,8,9,0,0,0,0,2,2,0,0,0,0,0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,10,0,0,0,0,0,0,0,0,0,0,11,11,11,11,0,0,2,2,2,2,2,0,0,11,11,11,11,11,0,0,11,2,2,11,0,0,2,1,1,1,2,0,0,11,2,2,2,11,0,0,11,11,11,11,0,0,2,1,1,1,2,0,0,11,11,11,11,11,0,0,0,0,0,0,0,0,2,2,2,2,2,0,0,0,0,0,0,0,0,2,0,0,10,10,10,10,10,10,10,10,10,10,10,10,10,10,0,0,2,2,2,0,0,0,0,0,0,0,12,0,0,0,0,0,0,0,0,2,2]}",
"level_12": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"vines\",\"assets:3,3\",\"player1start\",\"targetpoint\",\"player2start\",\"enemystart\"],\"data\":[1,1,2,1,1,1,1,3,0,0,4,0,0,5,1,2,2,2,2,2,1,1,1,1,1,2,1,1,0,0,0,0,0,1,1,2,2,2,2,2,1,2,2,2,2,2,1,2,1,0,0,0,1,1,1,1,1,1,2,2,1,1,1,2,2,1,1,2,1,2,2,2,2,2,1,2,1,1,2,2,1,2,1,2,2,1,2,2,2,2,2,2,1,1,1,2,1,2,2,2,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,2,1,1,2,1,1,2,1,1,2,2,1,1,2,2,2,2,2,2,2,2,1,1,2,1,1,2,2,1,2,2,2,1,1,1,1,1,2,1,1,1,1,2,2,1,1,1,2,1,2,2,2,2,2,2,2,1,2,1,1,2,1,1,1,1,2,2,2,1,2,2,1,1,1,1,1,1,2,1,2,2,2,2,2,2,6,1,1,1,2,1,1,1,1,1,6,1,2,1,1,1,1,1,1,6]}",
"level_13": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"assets:12,14\",\"player1start\",\"targetpoint\",\"player2start\",\"assets:12,9\",\"assets:13,9\",\"vines\",\"assets:12,8\",\"assets:13,8\",\"assets:11,9\",\"ocean\",\"enemystart\"],\"data\":[1,1,0,0,0,0,0,2,0,0,3,0,0,4,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,6,0,0,0,0,0,0,0,0,0,0,0,0,5,6,0,0,7,7,8,9,10,10,10,10,7,7,7,10,10,10,10,10,8,9,0,0,7,11,11,11,11,11,11,11,11,11,11,7,0,0,0,0,0,0,0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,7,11,11,11,11,11,11,11,11,11,7,0,1,0,0,1,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,1,1,0,5,6,11,11,11,11,11,11,11,7,0,1,0,0,5,6,0,1,0,0,8,9,10,10,10,10,0,0,0,10,10,0,10,10,8,9,0,0,0,0,12,0,0,0,0,0,0,12,0,0,0,0,0,12,0,0,0]}",
"level_14": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"player1start\",\"targetpoint\",\"player2start\",\"vines\",\"assets:21,6\",\"assets:22,6\",\"assets:11,9\",\"ocean\",\"enemystart\"],\"data\":[0,0,0,0,0,0,0,1,0,0,2,0,0,3,0,0,0,0,0,4,0,5,5,5,0,0,0,0,0,0,0,0,0,0,0,5,5,5,0,0,0,0,5,6,5,7,0,0,0,0,0,0,5,5,0,7,5,0,0,4,4,0,5,6,6,6,5,0,0,5,6,5,5,6,5,5,6,5,0,4,4,4,8,5,5,6,5,0,0,4,8,4,5,5,6,6,6,5,0,4,4,4,4,0,0,5,5,5,5,4,4,4,0,0,4,6,6,0,0,4,4,0,0,5,6,6,5,5,0,0,5,0,0,5,5,6,6,5,0,0,0,0,5,5,5,5,5,0,0,5,6,5,0,0,5,5,5,5,0,0,0,7,0,4,4,4,7,0,0,0,5,0,0,0,7,0,0,7,0,0,0,0,0,7,7,7,7,0,0,0,0,0,0,0,7,7,7,7,0,0,9,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,9]}",
"level_15": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"assets:6,3\",\"enemystart\",\"assets:7,3\",\"assets:8,3\",\"assets:5,23\",\"assets:6,23\",\"assets:7,23\",\"player2start\",\"assets:7,2\",\"assets:8,2\",\"vines\",\"assets:4,21\",\"assets:6,21\",\"assets:8,21\",\"assets:4,22\",\"assets:5,22\",\"assets:7,22\",\"assets:8,22\",\"targetpoint\",\"ocean\",\"assets:4,20\",\"assets:6,19\",\"assets:5,20\",\"assets:7,20\",\"assets:8,20\",\"player1start\",\"assets:7,19\",\"assets:5,19\"],\"data\":[0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,1,0,3,4,0,3,4,0,3,4,0,5,6,7,0,0,0,0,8,0,1,0,9,10,11,9,10,11,9,10,11,12,13,14,0,0,0,0,0,0,0,0,0,0,11,11,11,11,11,11,11,12,13,14,0,0,0,0,0,0,0,0,0,15,6,6,6,6,6,6,6,16,13,17,18,0,0,0,19,0,0,1,1,12,13,13,20,13,13,20,13,13,20,13,14,0,0,2,0,0,0,0,0,21,22,23,20,24,22,22,22,23,13,24,25,0,0,0,0,0,0,0,15,6,6,16,20,14,0,11,0,12,13,14,0,0,0,0,26,0,1,0,12,20,20,20,20,14,0,1,0,12,13,14,0,0,0,0,0,0,1,0,21,22,22,22,22,27,0,1,0,28,22,25,0,0,0,0,0,0,1,0,11,11,11,11,11,11,0,1,0,0,0,0,0,0,0,2]}",
"level_16": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"vines\",\"ocean\",\"enemystart\",\"assets:9,18\",\"assets:10,18\",\"assets:6,3\",\"assets:2,3\",\"player2start\",\"assets:9,17\",\"assets:10,17\",\"assets:5,2\",\"assets:2,14\",\"assets:3,14\",\"assets:4,14\",\"assets:2,13\",\"assets:3,13\",\"assets:4,13\",\"targetpoint\",\"assets:2,12\",\"assets:3,12\",\"assets:4,12\",\"assets:3,3\",\"assets:4,3\",\"player1start\",\"assets:2,2\",\"assets:3,2\",\"assets:4,2\"],\"data\":[0,0,0,1,1,1,1,0,1,1,1,1,1,0,0,0,0,2,0,3,0,0,0,4,5,6,0,0,0,0,7,7,0,0,0,0,0,2,0,0,8,0,0,9,10,6,0,0,0,0,0,7,0,0,0,11,0,2,0,0,0,0,0,9,10,6,0,0,12,13,14,0,7,7,1,11,0,2,0,0,0,0,0,4,5,6,0,1,15,16,17,0,7,7,1,11,0,2,0,0,18,0,0,9,10,6,0,1,19,20,21,1,7,7,0,11,0,0,0,3,0,0,0,4,5,6,0,1,1,1,0,1,7,0,0,11,0,2,0,0,0,0,0,9,10,6,0,1,7,22,23,1,7,7,1,11,0,2,0,0,24,0,0,4,5,6,0,1,25,26,27,0,7,7,1,11,0,2,0,0,0,0,0,9,10,6,0,0,0,0,0,0,7,0,0,0,0,2,0,0,0,0,1,1,1,1,0,1,1,1,1,1,1,0,0,0,0,2,0,3]}",
"level_17": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"assets:6,3\",\"enemystart\",\"ocean\",\"vines\",\"player2start\",\"targetpoint\",\"player1start\"],\"data\":[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,2,0,2,0,0,1,1,0,0,0,1,0,1,3,1,0,1,1,0,0,0,0,0,0,0,0,0,4,0,0,0,0,4,3,4,0,0,0,0,0,0,0,2,1,0,0,1,3,1,0,1,0,1,3,1,1,0,1,1,1,1,0,0,0,0,0,4,3,4,0,0,0,4,3,4,0,0,0,0,0,0,0,0,0,1,0,1,3,4,1,1,1,4,3,1,1,0,0,1,0,1,1,0,0,0,0,4,3,4,0,0,0,4,4,0,0,4,4,4,0,0,0,0,5,0,0,1,3,1,1,0,1,1,0,1,1,4,3,1,0,0,0,0,0,0,0,4,3,4,0,0,0,0,0,0,0,4,3,4,0,0,0,0,0,0,0,4,4,4,1,1,1,0,1,1,1,1,3,1,1,0,1,0,6,0,0,7,0,0,0,0,0,0,0,0,0,4,3,4,0,0,0,0]}",
"level_18": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"enemystart\",\"vines\",\"assets:6,3\",\"player2start\",\"targetpoint\",\"player1start\"],\"data\":[1,0,2,0,0,0,2,0,2,0,2,0,0,0,2,0,0,0,0,0,0,0,0,3,0,2,0,3,0,3,0,0,0,0,0,3,2,0,0,2,2,0,2,0,3,0,2,0,3,2,0,0,0,0,0,2,3,2,3,0,0,3,0,2,0,3,0,3,2,0,0,0,4,0,0,0,2,3,0,2,2,0,3,0,2,0,3,2,0,0,0,0,0,0,0,2,3,0,2,0,0,2,0,3,0,3,2,0,0,0,5,0,0,0,2,3,0,3,0,2,2,0,2,0,3,2,0,0,0,0,0,0,0,2,3,0,2,0,3,0,0,3,0,3,2,0,0,0,6,0,0,0,2,3,0,3,0,2,0,2,2,0,3,0,3,2,0,0,0,0,0,2,3,0,2,0,3,0,2,0,0,3,0,2,2,3,0,0,0,0,0,3,0,3,0,2,0,3,0,0,2,0,2,0,0,0,2,0,0,0,2,0,2,0,2,0,2,0,2,1]}",
"level_19": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"enemystart\",\"vines\",\"assets:6,3\",\"ocean\",\"player2start\",\"targetpoint\",\"player1start\"],\"data\":[1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1,0,0,3,0,3,0,2,4,4,4,2,4,4,4,2,3,0,3,0,0,0,3,3,0,3,0,2,3,3,3,2,3,3,3,2,3,0,3,3,0,0,0,0,0,3,0,2,3,0,0,2,0,5,3,2,3,0,0,0,0,0,3,3,3,3,0,2,3,0,0,0,0,0,3,2,3,3,3,3,0,2,2,2,2,2,2,2,2,2,0,6,0,2,2,2,2,2,2,2,2,0,3,3,3,3,0,2,3,0,0,0,0,0,3,2,3,3,3,3,0,0,0,0,0,3,0,2,3,7,0,2,0,0,3,2,3,0,0,0,0,0,3,3,0,3,0,2,3,3,3,2,3,3,3,2,3,0,3,3,0,0,0,3,0,3,0,2,4,4,4,2,4,4,4,2,3,0,3,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,1]}",
"level_20": "{\"width\":20,\"height\":11,\"block_width\":16,\"block_height\":16,\"sprites\":[0,\"enemystart\",\"vines\",\"assets:7,3\",\"assets:8,3\",\"assets:6,3\",\"assets:7,2\",\"assets:8,2\",\"ocean\",\"player2start\",\"targetpoint\",\"player1start\"],\"data\":[1,0,2,2,0,0,0,0,2,0,1,0,0,2,0,0,0,0,0,1,0,0,3,4,0,5,0,5,5,5,3,4,5,5,5,0,3,4,0,0,0,0,6,7,2,5,0,0,0,0,6,7,0,0,0,0,6,7,0,8,0,0,0,0,2,5,0,5,0,0,0,0,9,5,0,0,0,0,0,8,0,0,3,4,2,5,0,5,0,0,0,0,0,5,2,5,3,4,0,0,1,0,6,7,2,5,0,5,0,0,10,0,0,5,2,5,6,7,0,1,0,0,0,0,2,5,0,5,0,0,0,0,0,5,2,0,0,0,0,0,8,0,3,4,0,5,0,5,11,0,0,0,0,5,0,5,3,4,0,0,8,0,6,7,0,0,0,0,0,3,4,0,0,0,0,5,6,7,0,0,0,0,2,2,0,0,5,5,5,6,7,5,5,5,0,5,2,2,0,0,1,0,8,2,0,0,2,2,0,0,1,0,2,0,0,0,2,8,0,1]}"
},
"sounds": [{"file": "explosion.wav", "version": 1, "size": 123140, "properties": {}}, {
"file": "grenade2.wav",
"version": 1,
"size": 81126,
"properties": {}
}, {"file": "grenade3.wav", "version": 1, "size": 67046, "properties": {}}, {
"file": "jingle_lose_00.wav",
"version": 1,
"size": 1064068,
"properties": {}
}, {"file": "jingle_win_00.wav", "version": 1, "size": 756868, "properties": {}}, {
"file": "jumppad.wav",
"version": 1,
"size": 145324,
"properties": {}
}, {"file": "pickup_01.wav", "version": 1, "size": 23290, "properties": {}}, {
"file": "quaddamage_shoot.wav",
"version": 1,
"size": 303232,
"properties": {}
}, {"file": "ren.wav", "version": 1, "size": 224032, "properties": {}}, {
"file": "ren3.wav",
"version": 1,
"size": 224032,
"properties": {}
}, {"file": "rlauncher.wav", "version": 1, "size": 246786, "properties": {}}, {
"file": "teleport.wav",
"version": 1,
"size": 74196,
"properties": {}
}],
"music": [{"file": "ending.mp3", "version": 1, "size": 1134317, "properties": {}}, {
"file": "level1.mp3",
"version": 1,
"size": 2131380,
"properties": {}
}, {"file": "level2.mp3", "version": 1, "size": 1825757, "properties": {}}, {
"file": "level3.mp3",
"version": 1,
"size": 1926256,
"properties": {}
}, {"file": "titlescreen.mp3", "version": 1, "size": 393539, "properties": {}}]
};
globalThis.microScriptCode = `
function()
// AI Component that controls specific Entity
AiControllerComponent = class extends Component
//// constructor
// @huntTarget:string - what this AI controller should attack. Available values: TARGET, PLAYER, ENEMYFIRST, ENEMYLAST
// @moveSpeed:number - movement speed
// @maxObstacklesBeforeFire:int - number of colliders through which controller start shooting
// @prefPlayerNumber:int<0,2> - player number that this AI controller will hunt. 0 means player will be selected at random
constructor = function(huntTarget, moveSpeed, maxObstacklesBeforeFire, prefPlayerNumber = 0)
super()
// current state. Available: WAIT, IDLE, MOVE, ATTACK
this.State = "IDLE"
// hunt target for this AI controller. Can go after Target or after Player. Available values: TARGET, PLAYER, ENEMYFIRST, ENEMYLAST
// ENEMYFIRST and ENEMYLAST are special hunt targets assigned to Player entities during demo mode. They alwasy hunt first and last enemy in the list
this.HuntTarget = huntTarget
// number of player this controller will hunt.
this.PrefPlayerNumber = prefPlayerNumber
if this.PrefPlayerNumber == 0 then
if Game.Player2 != 0 then
this.PrefPlayerNumber = random.nextInt(2) + 1
else
this.PrefPlayerNumber = 1
end
end
// number of obstackles before AI controller will fire at target
// this is compared to result of Trace to check how many colliders on line of fire this AI should ignore
// Must be set to 2 or more - MapManager adds bunker around the Target, so it's almost never that the target is not behind the cover
this.MaxObstacklesBeforeFire = maxObstacklesBeforeFire
// move destination - AI will move here if in "move" state
this.MoveDestination = 0
// speed with which AI moves
this.MoveSpeed = moveSpeed
// ref to Entity that is an attack target. If equal to 0 then there's no attack target selected
this.AttackTarget = 0
end
//// Update - Update component
// @deltaTime:number - amount of time that passed since last update
Update = function(deltaTime)
// State Machine update
// IDLE state - AI does nothing. This is the spot where decision on next action is taken
if State == "IDLE" then
local transform = Owner.Transform
local player1Pos = Game.Player1.Transform.Position
local player2Pos = 0
if Game.Player2 != 0 then player2Pos = Game.Player2.Transform.Position end
local p1TraceLength = 1000
local p2TraceLength = 1000
// AI decision priority list
// 0. if HuntTarget == ENEMYFIRST or ENEMYLAST then it's a demo mode and should target enemies
// 1. attack player without cover
// 2. attack hunt target through cover
// 3. move to hunt target
// ###### DEMO MODE ####################################################################################
// handle special case of demo mode
// this is very buggy and francly, quite pointless
if HuntTarget == "ENEMYFIRST" or HuntTarget == "ENEMYLAST" then
local enemy = 0
if Game.Ai.Enemies.length > 0 then
if HuntTarget == "ENEMYFIRST" then enemy = Game.Ai.Enemies[0] end
if HuntTarget == "ENEMYLAST" then enemy = Game.Ai.Enemies[Game.Ai.Enemies.length - 1] end
end
if enemy == 0 then return 0 end // premature return, as ther's no enemy AI to attack
local enemyPos = enemy.Transform.Position
local enemyTraceLen = Game.Physics.Trace(transform.Position, enemyPos).length
if enemyTraceLen <= 2 then
AttackTarget = enemy
State = "ATTACK"
else
// can't attack. Move to enemy
local navGridX = floor((transform.Position.X + 160) / Game.Map.CurrentMap.block_width)
local navGridY = floor((transform.Position.Y + 84) / Game.Map.CurrentMap.block_height)
local nextStep = Game.Ai.GetNextStepToEnemy(enemy, navGridX, navGridY)
if nextStep != 0 or nextStep != 1 then
// translate to world coords
local x = nextStep.X * Game.Map.CurrentMap.block_width - 160 + 8
local y = nextStep.Y * Game.Map.CurrentMap.block_height - 84 + 8
MoveDestination = new Vector2D(x, y)
// check if MoveDestination is very far - this can happen sometimes XD
if transform.Position.Subtract(MoveDestination).GetLength() > 32 then return 0 end
State = "MOVE"
end
end
return 0 // when in demo mode don't perform any standard AI logic
end
// ###### DEMO MODE END ################################################################################
// Attack preffered player if not behind cover
AttackTarget = 0
if player2Pos == 0 then // only Player 1 exists / single player game
p1TraceLength = Game.Physics.Trace(transform.Position, player1Pos).length
// 2 colliders are collider of the player and collider of the AI itself. There's no other colliders between them
if p1TraceLength <= 2 then AttackTarget = Game.Player1 end
else // Player 2 exists / multiplayer game
// in multiplayer each AI need to check if any of the players are out of cover
p1TraceLength = Game.Physics.Trace(transform.Position, player1Pos).length
p2TraceLength = Game.Physics.Trace(transform.Position, player2Pos).length
if PrefPlayerNumber == 1 then // preffering attack Player 1
if p1TraceLength <= 2 then AttackTarget = Game.Player1
elsif p2TraceLength <= 2 then AttackTarget = Game.Player2 end
else // preffering attack Player 2
if p2TraceLength <= 2 then AttackTarget = Game.Player2
elsif p1TraceLength <= 2 then AttackTarget = Game.Player1 end
end
end
// if AttackTarget is set then a player is out of cover and should be attacked
if AttackTarget != 0 then
State = "ATTACK"
else
// attack hunt target through cover
if HuntTarget == "TARGET" then
// check if target is within allowed number of obstacles to shoot
local targetPos = Game.Target.Transform.Position
local targetTraceLength = Game.Physics.TraceAiToTarget(transform.Position, targetPos).length
if targetTraceLength <= MaxObstacklesBeforeFire then
AttackTarget = Game.Target
end
else // if hunt target is PLAYER
// check if player is within allowed number of obstacles to shoot
if PrefPlayerNumber == 1 then // pref player number is 1
if p1TraceLength <= MaxObstacklesBeforeFire then
AttackTarget = Game.Player1
end
else // pref player number is 2
if p2TraceLength <= MaxObstacklesBeforeFire then
AttackTarget = Game.Player2
end
end
end
// if AttackTarget is set then Target or preffered Player is within allowed number of obstacles to attack
if AttackTarget != 0 then
State = "ATTACK"
else
// otherwise - move closer to target
// translate current position into NavGrid coords
local navGridX = floor((transform.Position.X + 160) / Game.Map.CurrentMap.block_width)
local navGridY = floor((transform.Position.Y + 84) / Game.Map.CurrentMap.block_height)
// figure out next step on the path, depending if AI is hunting Target or Players
local nextStep = 0
if HuntTarget == "TARGET" then
nextStep = Game.Ai.GetNextStepToTarget(navGridX, navGridY)
elsif HuntTarget == "PLAYER" then
if PrefPlayerNumber == 1 then
nextStep = Game.Ai.GetNextStepToPlayer1(navGridX, navGridY)
else
nextStep = Game.Ai.GetNextStepToPlayer2(navGridX, navGridY)
end
end
if nextStep != 0 then
// translate to world coords
local x = nextStep.X * Game.Map.CurrentMap.block_width - 160 + 8
local y = nextStep.Y * Game.Map.CurrentMap.block_height - 84 + 8
MoveDestination = new Vector2D(x, y)
State = "MOVE"
else
// no next step on the path to target
if HuntTarget == "PLAYER" then
if PrefPlayerNumber == 1 then
Game.Ai.BuildVectorFieldToPlayer1()
else
Game.Ai.BuildVectorFieldToPlayer2()
end
end
end
end
end
end
// MOVE state - move closer to hunt target
if State == "MOVE" then
local transform = Owner.Transform
local movement = MoveDestination.Subtract(transform.Position)
if movement.GetLength() > 0.3 then // 0.3 is an trial-and-error value that makes AI not cut corners and stop "close enough" to middle of the cell
//if HuntTarget == "ENEMYFIRST" then print("moveLen=" + movement.GetLength()) end
transform.IsMoving = true
// normalize movement vector for corect diagonal speed
normalized = movement.GetNormalized()
transform.MovementDirection = normalized
// apply movement to entity's transform
transform.Position.X += normalized.X * MoveSpeed
transform.Position.Y += normalized.Y * MoveSpeed
transform.Rotation = normalized.ToAngle()
else
// if length to target is small enough, stop and go back to IDLE state
transform.IsMoving = false
State = "IDLE"
end
end
// ATTACK state - attack entity referenced in AttackTarget
if State == "ATTACK" then
local attack = Owner.GetComponent(AttackComponent)
if attack.CanAttack() then // CanAttack() just tracks weapon cooldown
attack.AttackTarget(AttackTarget)
State = "WAIT" // wait for weapon cooldown to pass before next action
end
end
// WAIT state
if State == "WAIT" then
local attack = Owner.GetComponent(AttackComponent)
if attack.CanAttack() then
State = "IDLE"
end
end
end
end
end()
function()
// represents AI overseer that coordinates AI components
AiOverseer = class
//// constructor
constructor = function()
// 2D list of vectors. Holds next move from current position on the way to target
TargetVectorField = 0
// 2D list of vectors. Holds next move from current position on the way to Player 1
Player1VectorField = 0
// 2D list of vectors. Holds next move from current position on the way to Player 2
Player2VectorField = 0
// list of EnemyVectorFieldTuple used in demo mode
EnemiesVectorFields = []
// Number of enemies left. When reach 0 AI Overseer is not allowed to spawn more
EnemiesPool = Database.GetEnemiesPool()
// Max number of enemies alive at the same time
MaxEnemies = Database.GetMaxEnemies()
// List of enemies currently on the map
Enemies = []
// list of Vector2D of enemy spawn points
EnemySpawnPoints = []
// cooldown in seconds between spawns of enemies
EnemySpawnCooldown = Database.GetEnemySpawnCooldown()
EnemySpawnCooldownTimer = 0 // timer incereased in Update(). When equals 0, then next enemy can be spawn
// flag that tells if Update() for AI Overseer is performed. Used to diable Update when in game over state
IsUpdateDisabled = false
end
//// SpawnNextEnemy - spawns next enemy
SpawnNextEnemy = function()
if EnemySpawnPoints.length > 0 then
// get enemy data from Database
local enemyData = Database.GetEnemy()
local enemy = new Entity("enemy")
local spawnPointIndex = random.nextInt(EnemySpawnPoints.length)
enemy.AddComponent(new TransformComponent(EnemySpawnPoints[spawnPointIndex].X, EnemySpawnPoints[spawnPointIndex].Y))
enemy.AddComponent(new TankSpriteComponent(enemyData.HullSprite, enemyData.GunSprite, enemyData.TrackSprite, enemyData.TrackOffset))
enemy.AddComponent(new AiControllerComponent(enemyData.HuntTarget, enemyData.MoveSpeed, enemyData.MaxObstacklesBeforeFire, enemyData.PrefPlayerNumber))
enemy.AddComponent(new AttackComponent(enemyData.ProjectileType, enemyData.AttackDamage, enemyData.ProjectileSpeed, enemyData.Cooldown))
enemy.AddComponent(new HealthComponent(enemyData.Health))
enemy.AddComponent(new CollisionComponent("ENEMY", EnemySpawnPoints[spawnPointIndex].X, EnemySpawnPoints[spawnPointIndex].Y, 16, 16, true, false))
Game.Spawn(enemy)
// enemy spawn VFX and SFX
Game.SpawnEffect("poof", EnemySpawnPoints[spawnPointIndex].X, EnemySpawnPoints[spawnPointIndex].Y, 60, 60, 0, 1.16)
Noise.EnemySpawned()
Enemies.push(enemy) // add enemy to list of alive enemies
EnemiesPool -= 1 // decrease number of enemies that are still waiting to be spawned
end
end
//// EnemyDestroyed - called by GameManager, informs Ai Overseer that one of the enemies was destroyed
// @enemyEntity:Entity - enemy that was destroyed
EnemyDestroyed = function(enemyEntity)
// remove enemy from the list of alive enemies
Enemies.removeElement(enemyEntity)
end
//// GetNextStepToTarget - Get NavGrid cell coords for next step on the path to target
// @currentX:int - X element of coords of current location
// @currentY:int - Y element of coords of current location
// @returns:Vector2D - vector with coords of next step on path to target. Returns 0 if no path available or already on target
GetNextStepToTarget = function(currentX, currentY)
local next = TargetVectorField[currentX][currentY]
if next == 0 or next == 1 then return 0
else return next end
end
//// GetNextStepToPlayer1 - Get NavGrid cell coords for next step on the path to Player 1
// @currentX:int - X element of coords of current location
// @currentY:int - Y element of coords of current location
// @returns:Vector2D - vector with coords of next step on path to Player 1. Returns 0 if no path available or already on Player 1 position
GetNextStepToPlayer1 = function(currentX, currentY)
if Player1VectorField == 0 then return 0 end
local next = Player1VectorField[currentX][currentY]
if next == 0 or next == 1 then return 0
else return next end
end
//// GetNextStepToPlayer2 - Get NavGrid cell coords for next step on the path to Player 2
// @currentX:int - X element of coords of current location
// @currentY:int - Y element of coords of current location
// @returns:Vector2D - vector with coords of next step on path to Player 1. Returns 0 if no path available or already on Player 1 position
GetNextStepToPlayer2 = function(currentX, currentY)
if Player2VectorField == 0 then return 0 end
local next = Player2VectorField[currentX][currentY]
if next == 0 or next == 1 then return 0
else return next end
end
//// GetNextStepToEnemy - Get NavGrid cell coords for next step on the path to supplied enemy
// This is only used in demo mode and additionally can rebuild VectorField if it's needed.
// @enemy:Entity - reference to enemy
// @currentX:int - X element of coords of current location
// @currentY:int - Y element of coords of current location
// @returns:Vector2D - vector with coords of next step on path to enemy. Returns 0 if already on enemy position
GetNextStepToEnemy = function(enemy, currentX, currentY)
local field = 0
for tuple in EnemiesVectorFields
if tuple.EnemyId == enemy.Id then field = tuple.VectorField end
end
if field == 0 then
local enemyPos = enemy.Transform.Position
field = BuildVectorField(enemyPos)
EnemiesVectorFields.push(new EnemyVectorFieldTuple(enemy.Id, field))
end
local next = field[currentX][currentY]
if next == 0 or next == 1 then
// if 0 or 1 then target moved and new VectorField needs to be generated
for tuple in EnemiesVectorFields
if tuple.EnemyId == enemy.Id then
local enemyPos = enemy.Transform.Position
tuple.VectorField = BuildVectorField(enemyPos)
return tuple.VectorField[currentX][currentY]
end
end
else return next end
end
//// BuildVectorFieldToTarget - Generates Vector Field to Target Entity using Breadth First Search.
BuildVectorFieldToTarget = function()
if Game.Target != 0 then
local targetPosition = Game.Target.Transform.Position
TargetVectorField = BuildVectorField(targetPosition, false)
end
end
//// BuildVectorFieldToPlayer1 - Generates Vector Field to Player 1 Entity using Breadth First Search.
BuildVectorFieldToPlayer1 = function()
if Game.Player1 != 0 then
local player1Position = Game.Player1.Transform.Position
Player1VectorField = BuildVectorField(player1Position, true)
end
end
//// BuildVectorFieldToPlayer2 - Generates Vector Field to Player 2 Entity using Breadth First Search.
BuildVectorFieldToPlayer2 = function()
if Game.Player2 != 0 then
local player2Position = Game.Player2.Transform.Position
Player2VectorField = BuildVectorField(player2Position, true)
end
end
//// BuildVectorField - generates Vector Field to supplied position using Breadth First Search
// Based on https://www.redblobgames.com/pathfinding/tower-defense/
// @targetPosition:Vector2D - position that is target of pathfinding
// @includeBunker:bool - if set to 'true' then constructed vector field will include bunker entities as impassable
// @returns:Vector2D[][] - 2D list of Vector2D objects, that holds next step on path to target
BuildVectorField = function(targetPosition, includeBunker)
local blockWidth = Game.Map.CurrentMap.block_width
local blockHeight = Game.Map.CurrentMap.block_height
// target coords in GridNav system
local targetNavX = floor((targetPosition.X + 160) / blockWidth)
local targetNavY = floor((targetPosition.Y + 84) / blockHeight)
// init vectorField - fill with 0
local vectorField = []
for x = 0 to Game.Map.CurrentMap.width - 1
vectorField.push([])
for y = 0 to Game.Map.CurrentMap.height - 1
vectorField[x].push(0)
end
end
// set 1 in the location of target
vectorField[targetNavX][targetNavY] = 1
// get frontier - all nodes that borders current one
local frontier = GetFrontier(targetNavX, targetNavY, vectorField, includeBunker) // on first iteration find frontier for target
while frontier.length > 0 // until frontier is empty
// add all nodes from frontier to TargetVectorField
for node in frontier
vectorField[node.PositionX][node.PositionY] = new Vector2D(node.ComeFromX, node.ComeFromY)
end
// select next node to act as center to find frontier for
local nextNode = frontier[0]
frontier.removeAt(0)
// include frontier for this new node into existing frontier
frontier = frontier.concat(GetFrontier(nextNode.PositionX, nextNode.PositionY, vectorField, includeBunker))
end // while
return vectorField
end
//// GetFrontier - Search map's NavGrid. Get all traversable nodes neighbouring provided coords
// @x:int - X element of provided coords
// @y:int - Y element of provided coords
// @vectorField:Vector2D[][] - current state of vector field being build
// @includeBunker:bool - if set to 'true' it will check if cell contains bunker entity and mark those as immpassable
// @returns:VectorFieldNode[] - list of VectorFieldNode objects
GetFrontier = function(x, y, vectorField, includeBunker)
local frontier = []
// Search NavGrid. Add nodes that hold 0 (traversable) and are not yet in TargetVectorField
local navGrid = Game.Map.NavGrid
// check all nodes that are neighbouring center element on X and Y axis (not diagonally)
// if the cell exists (is within NavGrid bounds) and was not checked before (value in vectorField is still 0)
// then add thios cell to frontier with info about it's center. Checks bunker if requested by function's argument.
if x-1 >= 0 then
if navGrid[x-1][y] == 0 and vectorField[x-1][y] == 0 then
local isTraversable = true
if includeBunker == true then
for pos in Game.Map.BunkerPositions
if pos.X == x-1 and pos.Y == y then
isTraversable = false
end
end
end
if isTraversable == true then
frontier.push(new VectorFieldNode(x-1, y, x, y))
end
end
end
if x+1 < Game.Map.CurrentMap.width then
if navGrid[x+1][y] == 0 and vectorField[x+1][y] == 0 then
local isTraversable = true
if includeBunker == true then
for pos in Game.Map.BunkerPositions
if pos.X == x+1 and pos.Y == y then
isTraversable = false
end
end
end
if isTraversable == true then
frontier.push(new VectorFieldNode(x+1, y, x, y))
end
end
end
if y-1 >= 0 then
if navGrid[x][y-1] == 0 and vectorField[x][y-1] == 0 then
local isTraversable = true
if includeBunker == true then
for pos in Game.Map.BunkerPositions
if pos.X == x and pos.Y == y-1 then
isTraversable = false
end
end
end
if isTraversable == true then
frontier.push(new VectorFieldNode(x, y-1, x, y))
end
end
end
if y+1 < Game.Map.CurrentMap.height then
if navGrid[x][y+1] == 0 and vectorField[x][y+1] == 0 then