-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.ts
2127 lines (2126 loc) · 84.2 KB
/
main.ts
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
namespace SpriteKind {
export const Chest = SpriteKind.create()
export const Seeing = SpriteKind.create()
export const Snake = SpriteKind.create()
export const Compass = SpriteKind.create()
export const Info = SpriteKind.create()
export const Clear_settings = SpriteKind.create()
export const Artifact_Trashbin = SpriteKind.create()
export const Artifact_Submit = SpriteKind.create()
}
scene.onOverlapTile(SpriteKind.Player, sprites.dungeon.doorLockedNorth, function (sprite, location) {
if (in_game) {
timer.throttle("display_cant_go_back_warning", 500, function () {
pause_enemies()
sprite_hero.y += 8
game.showLongText("It's pointless going back now!", DialogLayout.Bottom)
unpause_enemies()
})
}
})
function unpause_enemies () {
paused = false
}
function instructions () {
game.showLongText("Welcome to a horrible clone of TangoTek's " + "Decked Out from HermitCraft, " + "now on MakeCode Arcade!\\n" + "(Hold down [B] to skip when pressing [A])" + "", DialogLayout.Bottom)
if (!(controller.B.isPressed())) {
game.showLongText("Your goal is to follow the compass and try to find your treasure, hidden in the dungeon!", DialogLayout.Bottom)
game.showLongText("Along the way, there will be chests filled with smaller loot, such as coins or food!", DialogLayout.Bottom)
game.showLongText("You will definitely want to avoid the snakes." + "(Yeah, I was too lazy to draw a Ravager) " + "They will be patrolling the dungeon, " + "and if they get ahold of you, you'll die!" + "", DialogLayout.Bottom)
game.showLongText("The longer you stay in the dungeon, " + "the more clank you will generate. " + "This will awaken bats and ghost, " + "(which can fly through walls) " + "which won't be good!", DialogLayout.Bottom)
game.showLongText("When you are ready to enter, head through the doors on the right.", DialogLayout.Bottom)
game.showLongText("Good luck! You'll need it...", DialogLayout.Bottom)
}
}
function count_random_cookies (max: number) {
local_cookies = 0
for (let index = 0; index <= max; index++) {
if (Math.percentChance(coins_chance - index)) {
local_cookies += 1
} else {
return local_cookies
}
}
return local_cookies
}
function set_hero_animations () {
character.loopFrames(
sprite_hero,
[img`
. . . . . . . . . . . . . . . .
. . . . . f f f f f f . . . . .
. . . . f 2 f e e e e f f . . .
. . . f 2 2 2 f e e e e f f . .
. . . f e e e e f f e e e f . .
. . f e 2 2 2 2 e e f f f f . .
. . f 2 e f f f f 2 2 2 e f . .
. . f f f e e e f f f f f f f .
. . f e e 4 4 f b e 4 4 e f f .
. . f f e d d f 1 4 d 4 e e f .
. f d d f d d d d 4 e e e f . .
. f b b f e e e 4 e e f . . . .
. f b b e d d 4 2 2 2 f . . . .
. . f b e d d e 4 4 4 f f . . .
. . . f f e e f f f f f f . . .
. . . . f f f . . . f f . . . .
`,img`
. . . . . f f f f f f . . . . .
. . . . f 2 f e e e e f f . . .
. . . f 2 2 2 f e e e e f f . .
. . . f e e e e f f e e e f . .
. . f e 2 2 2 2 e e f f f f . .
. . f 2 e f f f f 2 2 2 e f . .
. . f f f e e e f f f f f f f .
. . f e e 4 4 f b e 4 4 e f f .
. . f f e d d f 1 4 d 4 e e f .
. f d d f d d d d 4 e e e f . .
. f b b f e e e 4 e e f f . . .
. f b b e d d 4 2 2 2 f . . . .
. . f b e d d e 2 2 2 e . . . .
. . . f f e e f 4 4 4 f . . . .
. . . . . f f f f f f . . . . .
. . . . . . . f f f . . . . . .
`],
200,
character.rule(Predicate.MovingLeft)
)
character.loopFrames(
sprite_hero,
[img`
. . . . . . . . . . . . . . . .
. . . . . f f f f f f . . . . .
. . . f f e e e e f 2 f . . . .
. . f f e e e e f 2 2 2 f . . .
. . f e e e f f e e e e f . . .
. . f f f f e e 2 2 2 2 e f . .
. . f e 2 2 2 f f f f e 2 f . .
. f f f f f f f e e e f f f . .
. f f e 4 4 e b f 4 4 e e f . .
. f e e 4 d 4 1 f d d e f f . .
. . f e e e 4 d d d d f d d f .
. . . . f e e 4 e e e f b b f .
. . . . f 2 2 2 4 d d e b b f .
. . . f f 4 4 4 e d d e b f . .
. . . f f f f f f e e f f . . .
. . . . f f . . . f f f . . . .
`,img`
. . . . . f f f f f f . . . . .
. . . f f e e e e f 2 f . . . .
. . f f e e e e f 2 2 2 f . . .
. . f e e e f f e e e e f . . .
. . f f f f e e 2 2 2 2 e f . .
. . f e 2 2 2 f f f f e 2 f . .
. f f f f f f f e e e f f f . .
. f f e 4 4 e b f 4 4 e e f . .
. f e e 4 d 4 1 f d d e f f . .
. . f e e e 4 d d d d f d d f .
. . . f f e e 4 e e e f b b f .
. . . . f 2 2 2 4 d d e b b f .
. . . . e 2 2 2 e d d e b f . .
. . . . f 4 4 4 f e e f f . . .
. . . . . f f f f f f . . . . .
. . . . . . f f f . . . . . . .
`],
200,
character.rule(Predicate.MovingRight)
)
character.loopFrames(
sprite_hero,
[img`
. . . . . . . . . . . . . . . .
. . . . . f f f f . . . . . . .
. . . f f e e e e f f . . . . .
. . f e e e f f e e e f . . . .
. . f f f f 2 2 f f f f . . . .
. f f e 2 e 2 2 e 2 e f f . . .
. f e 2 f 2 f f f 2 f e f . . .
. f f f 2 f e e 2 2 f f f . . .
. f e 2 f f e e 2 f e e f . . .
f f e f f e e e f e e e f f . .
f f e e e e e e e e e e f d f .
. . f e e e e e e e e f f b f .
. . e f f f f f f f f 4 f b f .
. . 4 f 2 2 2 2 2 e d d f c f .
. . e f f f f f f e e 4 f f . .
. . . f f f . . . . . . . . . .
`,img`
. . . . . . . . . . . . . . . .
. . . . . f f f f . . . . . . .
. . . f f e e e e f f . . . . .
. . f e e e f f e e e f . . . .
. . f f f f 2 2 f f f f . . . .
. f f e 2 e 2 2 e 2 e f f . . .
. f e f 2 f f f 2 f 2 e f . . .
. f f f 2 2 e e f 2 f f f . . .
. f e e f 2 e e f f 2 e f . . .
. f e e e f e e e f f e f f . .
. f e e e e e e e e e e f f . .
. f f e e e e e e e e f . . . .
. f 4 f f f f f f f f e . . . .
. f d d e 2 2 2 2 2 f 4 . . . .
. f 4 e e f f f f f f e . . . .
. . . . . . . . f f f . . . . .
`],
200,
character.rule(Predicate.MovingUp)
)
character.loopFrames(
sprite_hero,
[img`
. . . . . . . . . . . . . . . .
. . . . . . f f f f . . . . . .
. . . . f f f 2 2 f f f . . . .
. . . f f f 2 2 2 2 f f f . . .
. . f f f e e e e e e f f f . .
. . f f e 2 2 2 2 2 2 e e f . .
. f f e 2 f f f f f f 2 e f f .
. f f f f f e e e e f f f f f .
. . f e f b f 4 4 f b f e f . .
. f f e 4 1 f d d f 1 4 e f . .
f d f f e 4 d d d d 4 e f e . .
f b f e f 2 2 2 2 e d d 4 e . .
f b f 4 f 2 2 2 2 e d d e . . .
f c f . f 4 4 5 5 f e e . . . .
. f f . f f f f f f f . . . . .
. . . . f f f . . . . . . . . .
`,img`
. . . . . . . . . . . . . . . .
. . . . . . f f f f . . . . . .
. . . . f f f 2 2 f f f . . . .
. . . f f f 2 2 2 2 f f f . . .
. . f f f e e e e e e f f f . .
. . f e e 2 2 2 2 2 2 e f f . .
. f f e 2 f f f f f f 2 e f f .
. f f f f f e e e e f f f f f .
. . f e f b f 4 4 f b f e f . .
. . f e 4 1 f d d f 1 4 e f . .
. . e f f f f d d d 4 e f . . .
. . f d d d d f 2 2 2 f e f . .
. . f b b b b f 2 2 2 f 4 e . .
. . f b b b b f 5 4 4 f . . . .
. . . f c c f f f f f f . . . .
. . . . f f . . . f f f . . . .
`],
200,
character.rule(Predicate.MovingDown)
)
character.runFrames(
sprite_hero,
[img`
. . . . . f f f f f f . . . . .
. . . f f e e e e f 2 f . . . .
. . f f e e e e f 2 2 2 f . . .
. . f e e e f f e e e e f . . .
. . f f f f e e 2 2 2 2 e f . .
. . f e 2 2 2 f f f f e 2 f . .
. f f f f f f f e e e f f f . .
. f f e 4 4 e b f 4 4 e e f . .
. f e e 4 d 4 1 f d d e f f . .
. . f e e e 4 d d d d f d d f .
. . . f f e e 4 e e e f b b f .
. . . . f 2 2 2 4 d d e b b f .
. . . . e 2 2 2 e d d e b f . .
. . . . f 4 4 4 f e e f f . . .
. . . . . f f f f f f . . . . .
. . . . . . f f f . . . . . . .
`],
200,
character.rule(Predicate.NotMoving, Predicate.FacingRight)
)
character.runFrames(
sprite_hero,
[img`
. . . . . f f f f f f . . . . .
. . . . f 2 f e e e e f f . . .
. . . f 2 2 2 f e e e e f f . .
. . . f e e e e f f e e e f . .
. . f e 2 2 2 2 e e f f f f . .
. . f 2 e f f f f 2 2 2 e f . .
. . f f f e e e f f f f f f f .
. . f e e 4 4 f b e 4 4 e f f .
. . f f e d d f 1 4 d 4 e e f .
. f d d f d d d d 4 e e e f . .
. f b b f e e e 4 e e f f . . .
. f b b e d d 4 2 2 2 f . . . .
. . f b e d d e 2 2 2 e . . . .
. . . f f e e f 4 4 4 f . . . .
. . . . . f f f f f f . . . . .
. . . . . . . f f f . . . . . .
`],
200,
character.rule(Predicate.NotMoving, Predicate.FacingLeft)
)
character.runFrames(
sprite_hero,
[img`
. . . . . f f f f . . . . . . .
. . . f f e e e e f f . . . . .
. . f e e e f f e e e f . . . .
. f f f f f 2 2 f f f f f . . .
. f f e 2 e 2 2 e 2 e f f . . .
. f e 2 f 2 f f 2 f 2 e f . . .
. f f f 2 2 e e 2 2 f f f . . .
f f e f 2 f e e f 2 f e f f . .
f e e f f e e e e f e e e f . .
. f e e e e e e e e e e f . . .
. . f e e e e e e e e f d f . .
. e 4 f f f f f f f f f b f . .
. 4 d f 2 2 2 2 2 2 f f b f . .
. 4 4 f 4 4 4 4 4 4 f f c f . .
. . . . f f f f f f . f f . . .
. . . . f f . . f f . . . . . .
`],
200,
character.rule(Predicate.NotMoving, Predicate.FacingUp)
)
character.runFrames(
sprite_hero,
[img`
. . . . . . f f f f . . . . . .
. . . . f f f 2 2 f f f . . . .
. . . f f f 2 2 2 2 f f f . . .
. . f f f e e e e e e f f f . .
. . f f e 2 2 2 2 2 2 e e f . .
. . f e 2 f f f f f f 2 e f . .
. . f f f f e e e e f f f f . .
. f f e f b f 4 4 f b f e f f .
. f e e 4 1 f d d f 1 4 e e f .
. . f f f f d d d d d e e f . .
. f d d d d f 4 4 4 e e f . . .
. f b b b b f 2 2 2 2 f 4 e . .
. f b b b b f 2 2 2 2 f d 4 . .
. . f c c f 4 5 5 4 4 f 4 4 . .
. . . f f f f f f f f . . . . .
. . . . . f f . . f f . . . . .
`],
200,
character.rule(Predicate.NotMoving, Predicate.FacingDown)
)
character.setCharacterAnimationsEnabled(sprite_hero, true)
}
controller.B.onEvent(ControllerButtonEvent.Pressed, function () {
if (in_game) {
timer.throttle("try_eat_cookie", 2000, function () {
if (user_cookies > 0 && info.life() <= 18) {
controller.moveSprite(sprite_hero, 20, 20)
running = false
sprite_hero.startEffect(effects.trail)
timer.after(2000, function () {
controller.moveSprite(sprite_hero, 50, 50)
effects.clearParticles(sprite_hero)
if (controller.B.isPressed()) {
user_cookies += -1
info.changeLifeBy(2)
sprite_hero.say("" + user_cookies + " cookie(s) left!", 2000)
}
})
} else {
if (info.life() > 18) {
sprite_hero.say("Full on health!", 2000)
} else {
sprite_hero.say("No cookies. :(", 2000)
}
}
})
}
})
function update_compass (player_x: number, player_y: number, target_x: number, target_y: number) {
local_radians_to_target = Math.atan2(player_y - target_y, player_x - target_x)
local_degree_to_target = 180 * local_radians_to_target / Math.atan2(0, -1)
sprite_compass.setFlag(SpriteFlag.Invisible, false)
if (within_range(local_degree_to_target, 90, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 2 1 1 1 1 1 f . .
. f 1 1 1 1 1 2 1 1 1 1 1 f . .
f 1 1 1 1 1 1 2 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 2 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 2 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 f 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 c 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 c 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 c 1 1 1 1 1 1 f .
. f 1 1 1 1 1 c 1 1 1 1 1 f . .
. f 1 1 1 1 1 c 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
} else if (within_range(local_degree_to_target, 135, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 2 1 f . .
f 1 1 1 1 1 1 1 1 1 2 1 1 1 f .
f 1 1 1 1 1 1 1 1 2 1 1 1 1 f .
f 1 1 1 1 1 1 1 2 1 1 1 1 1 f .
f 1 1 1 1 1 1 f 1 1 1 1 1 1 f .
f 1 1 1 1 1 c 1 1 1 1 1 1 1 f .
f 1 1 1 1 c 1 1 1 1 1 1 1 1 f .
f 1 1 1 c 1 1 1 1 1 1 1 1 1 f .
. f 1 c 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
} else if (within_range(local_degree_to_target, 180, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 c c c c c f 2 2 2 2 2 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
} else if (within_range(local_degree_to_target, -135, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 c 1 1 1 1 1 1 1 1 1 f . .
f 1 1 1 c 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 c 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 c 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 f 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 2 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 2 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 2 1 1 1 f .
. f 1 1 1 1 1 1 1 1 1 2 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
} else if (within_range(local_degree_to_target, -90, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 c 1 1 1 1 1 f . .
. f 1 1 1 1 1 c 1 1 1 1 1 f . .
f 1 1 1 1 1 1 c 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 c 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 c 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 f 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 2 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 2 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 2 1 1 1 1 1 1 f .
. f 1 1 1 1 1 2 1 1 1 1 1 f . .
. f 1 1 1 1 1 2 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
} else if (within_range(local_degree_to_target, -45, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 c 1 f . .
f 1 1 1 1 1 1 1 1 1 c 1 1 1 f .
f 1 1 1 1 1 1 1 1 c 1 1 1 1 f .
f 1 1 1 1 1 1 1 c 1 1 1 1 1 f .
f 1 1 1 1 1 1 f 1 1 1 1 1 1 f .
f 1 1 1 1 1 2 1 1 1 1 1 1 1 f .
f 1 1 1 1 2 1 1 1 1 1 1 1 1 f .
f 1 1 1 2 1 1 1 1 1 1 1 1 1 f .
. f 1 2 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
} else if (within_range(local_degree_to_target, 0, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 2 2 2 2 2 f c c c c c 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 1 1 1 1 f .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
} else if (within_range(local_degree_to_target, 45, 22)) {
sprite_compass.setImage(img`
. . . . f f f f f f f . . . . .
. . f f 1 1 1 1 1 1 1 f f . . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. f 1 2 1 1 1 1 1 1 1 1 1 f . .
f 1 1 1 2 1 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 2 1 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 2 1 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 f 1 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 c 1 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 c 1 1 1 1 f .
f 1 1 1 1 1 1 1 1 1 c 1 1 1 f .
. f 1 1 1 1 1 1 1 1 1 c 1 f . .
. f 1 1 1 1 1 1 1 1 1 1 1 f . .
. . f f 1 1 1 1 1 1 1 f f . . .
. . . . f f f f f f f . . . . .
. . . . . . . . . . . . . . . .
`)
}
}
function set_loot_tables () {
// Format:
// 0: Name
// 1: Description
// 2: Rarity
// 3: Set (for tracking)
// 4: Rarity (for tracking)
//
// Example:
// ["Red Toy Car", "A red toy car, fun to play with!", "Common", "car", "common"]
//
// List of sets: https://hermitcraft.fandom.com/wiki/Decked_Out#Sets
loot_table = [
["Dragon set - Obsidian", "Some really black rock.", "Common", "dragon", "common"],
["Dragon set - End Crystal", "Directly exported from the End dimension.", "Uncommon", "dragon", "uncommon"],
["Dragon set - Dragon's Breath", "Some smelly gas for brewing.", "Rare", "dragon", "rare"],
["Dragon set - Dragon's Head", "Thankfully, it's just a model.", "Unique", "dragon", "unique"],
["Wither set - Soul Sand", "Fresh brown sand direct from the Nether dimension.", "Common", "wither", "common"],
["Wither set - Wither Rose", "A special flower that you don't want to plant.", "Uncommon", "wither", "uncommon"],
["Wither set - Wither Head", "A great spoil of war that's very creepy.", "Rare", "wither", "rare"],
["Wither set - Nether Star", "Looks just like a star...", "Unique", "wither", "unique"],
["Ocean set - Sea Pickle", "A sea pickle that has been pickled for preservation.", "Common", "ocean", "common"],
["Ocean set - Sea Lantern", "Used for lighting up the Ocean Monuments.", "Uncommon", "ocean", "uncommon"],
["Ocean set - Sponge", "A sponge to soak up water, found in Ocean Monuments.", "Rare", "ocean", "rare"],
["Ocean set - Heart of the Sea", "The coveted Heart of the Sea.", "Unique", "ocean", "unique"],
["End set - End Rod", "Shiny stick!", "Common", "end", "common"],
["End set - Eye of Ender", "Creepy circle thing that looks like an eye.", "Uncommon", "end", "uncommon"],
["End set - Ender Chest", "Store your stuff in here and never lose it again!", "Rare", "end", "rare"],
["End set - Shulker Head", "The head of a Shulker.", "Unique", "end", "unique"],
["Nether set - Glowstone", "A glowing stone. Simple.", "Common", "nether", "common"],
["Nether set - Shroomlight", "A natural source of light in the Nether.", "Uncommon", "nether", "uncommon"],
["Nether set - Ancient Debris", "Something everyone seems to want these days...", "Rare", "nether", "rare"],
["Nether set - Respawn Anchor", "Died in the Nether? Hope your Anchor was charged!", "Unique", "nether", "unique"],
["Shiny set - Lapis Lazuli Block", "The Imposter of the Diamond Block.", "Common", "shiny", "common"],
["Shiny set - Gold Block", "A whole block of gold. Uber heavy!", "Uncommon", "shiny", "uncommon"],
["Shiny set - Emerald Block", "Villagers kill for this stuff. Seriously.", "Rare", "shiny", "rare"],
["Shiny set - Diamond Block", "The real-deal stuff. Keep care of it!", "Unique", "shiny", "unique"],
["Bee set - Honey Block", "A solidified cube of honey. Very sticky!", "Common", "bee", "common"],
["Bee set - Honeycomb", "Direct from the beehives!", "Uncommon", "bee", "uncommon"],
["Bee set - Beehive", "A hive of bees.", "Rare", "bee", "rare"],
["Bee set - Angry Bee Head", "You are lucky this is just a head!", "Unique", "bee", "unique"],
["Witch set - Nether Wart", "Reminds me of mushrooms...", "Common", "witch", "common"],
["Witch set - Cauldron", "I don't have a clue on how that fits in the chest.", "Uncommon", "witch", "uncommon"],
["Witch set - Brewing Stand", "A real brewing stand used by real witches.", "Rare", "witch", "rare"],
["Witch set - Witch Head", "Ewww...they actually have warts on their noses!", "Unique", "witch", "unique"],
["Enchantment set - Lapis Lazuli", "How do you pronounce the name of this stuff?!", "Common", "enchantment", "common"],
["Enchantment set - Bookshelf", "Reading is good for you.", "Uncommon", "enchantment", "uncommon"],
["Enchantment set - Bottle O' Enchanting", "Has liquid XP in here! Don't drop it!", "Rare", "enchantment", "rare"],
["Enchantment set - Enchanting Table", "Make your tools shiny.", "Unique", "enchantment", "unique"],
["Poison set - Rotten Flesh", "Stinky!", "Common", "poison", "common"],
["Poison set - Spider Eye", "I hate spiders. So creepy.", "Uncommon", "poison", "uncommon"],
["Poison set - Pufferfish", "Spikey!", "Rare", "poison", "rare"],
["Poison set - Poisonous Potato", "This potato grew some spuds.", "Unique", "poison", "unique"],
["Villager set - Hay Bales", "Efficient wheat storage!", "Common", "villager", "common"],
["Villager set - Anvil", "Bang! Bang! Bang!", "Uncommon", "villager", "uncommon"],
["Villager set - Bell", "STOP RUNNING, I JUST RUNG IT FOR FUN!", "Rare", "villager", "rare"],
["Villager set - Iron Golem Head", "How in the world did you get this?!", "Unique", "villager", "unique"],
["Snowman set - Stick", "Stick.", "Common", "snowman", "common"],
["Snowman set - Snow Block", "Hmmm...still frozen somehow.", "Uncommon", "snowman", "uncommon"],
["Snowman set - Carrot", "Yum!", "Rare", "snowman", "rare"],
["Snowman set - Snow Golem Head", "Nice model someone made and forgot about.", "Unique", "snowman", "unique"],
["Baking set - Bread", "Fresh from the oven!", "Common", "baking", "common"],
["Baking set - Furnace", "The oven in \"Fresh from the oven!\"", "Uncommon", "baking", "uncommon"],
["Baking set - Cocoa Beans", "In reality, they are really bitter by themselves.", "Rare", "baking", "rare"],
["Baking set - Pumpkin Pie", "I LOVE PUMPKIN PIE.", "Unique", "baking", "unique"],
["Desert set - Chiseled Sandstone", "Sandy.", "Common", "desert", "common"],
["Desert set - Cactus", "Very pointy.", "Uncommon", "desert", "uncommon"],
["Desert set - Dead Bush", "Dead as a, well, dead bush.", "Rare", "desert", "rare"],
["Desert set - Husk Head", "Hmmm...I wonder what mob it came from? (Hint: It's Husk)", "Unique", "desert", "unique"],
["Boomer set - Gunpowder", "Very...powdery...", "Common", "boomer", "common"],
["Boomer set - Rocket", "This looks fun to play with!", "Uncommon", "boomer", "uncommon"],
["Boomer set - TNT", "Actually called trinitrotoluene or something like that.", "Rare", "boomer", "rare"],
["Boomer set - Boomer Map", "The infamous Boomer's logo on a map!", "Unique", "boomer", "unique"],
["Jungle set - Bamboo", "Grows very fast.", "Common", "jungle", "common"],
["Jungle set - Vines", "This stuff spreads everywhere!", "Uncommon", "jungle", "uncommon"],
["Jungle set - Melon", "Watermelons are the best fruit. Period.", "Rare", "jungle", "rare"],
["Jungle set - Parrot Head", "At least it isn't the Pesky Bird's head.", "Unique", "jungle", "unique"],
["Poultry set - Feather", "Does it tickle for you?", "Common", "poultry", "common"],
["Poultry set - Egg", "Scrambled eggs taste good.", "Uncommon", "poultry", "uncommon"],
["Poultry set - Cooked Chicken", "Restores 3 meat stick things.", "Rare", "poultry", "rare"],
["Poultry set - Chicken Head", "Awww...so cute!", "Unique", "poultry", "unique"]
]
loot_sets = [
"dragon",
"wither",
"ocean",
"end",
"nether",
"shiny",
"bee",
"witch",
"enchantment",
"poison",
"villager",
"snowman",
"baking",
"desert",
"boomer",
"jungle",
"poultry"
]
coins_chance = 50
}
function get_random_cookies (max: number) {
pause_enemies()
local_cookies_got = count_random_cookies(max)
user_cookies += local_cookies_got
if (local_cookies_got == 0) {
game.showLongText("Dang, you didn't get anything! :(", DialogLayout.Bottom)
} else {
game.showLongText("Oh look, you found some cookies!", DialogLayout.Bottom)
game.showLongText("You found:\\n" + local_cookies_got + " cookie(s)!", DialogLayout.Center)
}
unpause_enemies()
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.Clear_settings, function (sprite, otherSprite) {
while (sprite.overlapsWith(otherSprite)) {
sprite.x += -2
sprite.y += -2
}
if (game.ask("Are you sure you want", "to reset?") && game.ask("You can't go back after", "this!")) {
blockSettings.clear()
pause(100)
game.showLongText("Done clearing data! Restarting!", DialogLayout.Bottom)
pause(100)
color.startFade(color.originalPalette, color.Black, 1000)
color.pauseUntilFadeDone()
game.reset()
}
})
function tp_to_random_spawner (sprite: Sprite) {
local_random = randint(0, 3)
if (local_random == 0) {
tiles.placeOnRandomTile(sprite, sprites.dungeon.doorClosedNorth)
} else if (local_random == 1) {
tiles.placeOnRandomTile(sprite, sprites.dungeon.doorClosedWest)
} else if (local_random == 2) {
tiles.placeOnRandomTile(sprite, sprites.dungeon.doorClosedSouth)
} else {
tiles.placeOnRandomTile(sprite, sprites.dungeon.doorClosedEast)
}
}
controller.A.onEvent(ControllerButtonEvent.Pressed, function () {
if (info.score() > 0 && in_game) {
controller.moveSprite(sprite_hero, 75, 75)
running = true
}
})
function within_range (x: number, middle: number, difference: number) {
return x < middle + difference && x > middle - difference
}
function submit_set () {
local_user_artifacts_simple = []
local_user_artifacts_submitting = []
controller.moveSprite(sprite_hero, 0, 0)
for (let artifact of user_artifacts) {
local_user_artifacts_simple.push("" + artifact[0] + " - " + artifact[2])
}
local_user_artifacts_simple.push("Cancel")
while (local_user_artifacts_submitting.length < 4) {
local_option_selected = false
blockMenu.showMenu(local_user_artifacts_simple, MenuStyle.Grid, MenuLocation.FullScreen)
while (!(local_option_selected)) {
pause(100)
}
if (blockMenu.selectedMenuOption() == "Cancel") {
game.showLongText("Canceled!", DialogLayout.Bottom)
blockMenu.closeMenu()
controller.moveSprite(sprite_hero, 50, 50)
return
}
if (!(local_user_artifacts_simple[blockMenu.selectedMenuIndex()].includes("[SUBMITTED] "))) {
local_user_artifacts_simple[blockMenu.selectedMenuIndex()] = "[SUBMITTED] " + local_user_artifacts_simple[blockMenu.selectedMenuIndex()] + "" + "" + ""
local_user_artifacts_submitting.push(blockMenu.selectedMenuIndex())
} else {
local_user_artifacts_simple[blockMenu.selectedMenuIndex()] = local_user_artifacts_simple[blockMenu.selectedMenuIndex()].substr(12, local_user_artifacts_simple[blockMenu.selectedMenuIndex()].length - 12)
local_user_artifacts_submitting.removeAt(local_user_artifacts_submitting.indexOf(blockMenu.selectedMenuIndex()))
}
}
blockMenu.closeMenu()
local_all_same_type = true
local_first_type = user_artifacts[local_user_artifacts_submitting[0]][3]
for (let index of local_user_artifacts_submitting) {
if (user_artifacts[index][3] != local_first_type) {
local_all_same_type = false
}
}
if (local_all_same_type) {
game.showLongText("Hmmm...they are all the same type...", DialogLayout.Bottom)
} else {
game.showLongText("They aren't even from the same set! You're wasting my time! I DO have other things to do, you know!", DialogLayout.Bottom)
controller.moveSprite(sprite_hero, 50, 50)
return
}
local_submitted_rarities = [""]
controller.moveSprite(sprite_hero, 50, 50)
for (let index of local_user_artifacts_submitting) {
local_submitted_rarities.push(user_artifacts[index][4])
}
local_rarity_findings = [local_submitted_rarities.indexOf("common"), local_submitted_rarities.indexOf("uncommon"), local_submitted_rarities.indexOf("rare"), local_submitted_rarities.indexOf("unique")]
for (let index of local_rarity_findings) {
if (index == -1) {
game.showLongText("...but you don't have all of them! You're wasting my precious time!", DialogLayout.Bottom)
controller.moveSprite(sprite_hero, 50, 50)
return
}
}
game.showLongText("...and you have all of them! Congratulations!", DialogLayout.Bottom)
local_user_artifacts_copy = []
for (let artifact of user_artifacts) {
local_user_artifacts_copy.push(artifact)
}
for (let index of local_user_artifacts_submitting) {
user_artifacts.removeAt(user_artifacts.indexOf(local_user_artifacts_copy[index]))
}
game.showLongText("10 coins awarded!", DialogLayout.Bottom)
info.changeScoreBy(10)
game.showLongText("Hero Score increased!", DialogLayout.Bottom)
user_hero_score += 1
timer.after(500, function () {
effects.confetti.startScreenEffect(1000)
music.powerUp.play()
})
controller.moveSprite(sprite_hero, 50, 50)
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.Chest, function (sprite, otherSprite) {
if (!(sprites.readDataBoolean(otherSprite, "opened"))) {
pause(100)
sprite_artifact_chest.setImage(img`
. b b b b b b b b b b b b b b .
b e 4 4 4 4 4 4 4 4 4 4 4 4 4 b
b e 4 4 4 4 4 4 4 4 4 4 4 4 e b
b e e 4 4 4 4 4 4 4 4 4 4 e e b
b b b b b b b d d b b b b b b b
. b b b b b b c c b b b b b b .
b c c c c c b c c b c c c c c b
b c c c c c c b b c c c c c c b
b c c c c c c c c c c c c c c b
b c c c c c c c c c c c c c c b
b b b b b b b b b b b b b b b b
b e e e e e e e e e e e e e e b
b e e e e e e e e e e e e e e b
b c e e e e e e e e e e e e c b
b b b b b b b b b b b b b b b b
. b b . . . . . . . . . . b b .
`)
sprites.setDataBoolean(sprite_artifact_chest, "opened", true)
game.showLongText("This is where your artifacts are kept after you survive a run! You can have up to 12 items!", DialogLayout.Bottom)
if (user_artifacts.length > 0) {
for (let index = 0; index <= user_artifacts.length - 1; index++) {
game.showLongText("Artifact #" + (index + 1) + ":\\n" + user_artifacts[index][0] + "\\n" + user_artifacts[index][1] + "\\nRarity: " + user_artifacts[index][2], DialogLayout.Center)
}
} else {
game.showLongText("Aww...you don't have any! Go and get some!", DialogLayout.Bottom)
}
}
})
function summon_ghost () {
sprite_ghost = sprites.create(img`
........................
........................
........................
........................
..........ffff..........
........ff1111ff........
.......fb111111bf.......
.......f11111111f.......
......fd11111111df......
......fd11111111df......
......fddd1111dddf......
......fbdbfddfbdbf......
......fcdcf11fcdcf......
.......fb111111bf.......
......fffcdb1bdffff.....
....fc111cbfbfc111cf....
....f1b1b1ffff1b1b1f....
....fbfbffffffbfbfbf....
.........ffffff.........
...........fff..........
........................
........................
........................
........................
`, SpriteKind.Enemy)
tp_to_random_spawner(sprite_ghost)
sprites.setDataBoolean(sprite_ghost, "see_player", false)
sprites.setDataNumber(sprite_ghost, "see_cooldown", 10)
sprites.setDataNumber(sprite_ghost, "damage_rate", 500)
sprites.setDataNumber(sprite_ghost, "damage", -3)
sprites.setDataString(sprite_ghost, "species", "ghost")
character.runFrames(
sprite_ghost,
[img`
........................
........................
........................
........................
..........ffff..........
........ff1111ff........
.......fb111111bf.......
.......f1111111df.......
......fd1111111ddf......
......fd111111dddf......
......fd111ddddddf......
......fd1dfbddddbf......
......fbddfcdbbbcf......
.......f11111bbcf.......
.......f1b1fffff........
.......fbfc111bf........
........ff1b1bff........
.........fbfbfff.f......
..........ffffffff......
............fffff.......
........................
........................
........................
........................
`],
500,
character.rule(Predicate.FacingLeft)
)
character.runFrames(
sprite_ghost,
[img`
........................
........................
........................
........................
..........fffff.........
........ff11111f........
.......fb111111bf.......
......fbd1111111f.......
......fddd111111df......
......fdddd11111df......
......fddddddd11df......
......fddddddd111f......
......fddddddcf11f......
.......fbdddb1111bf.....
........fffcfdb1b1f.....
.......ffffffffbfbf.....
....ff.fffffffffff......
.....ffffffff...........
.....ffffffb1b1f........
......ffffffbfbf........
........................
........................
........................
........................
`],
500,
character.rule(Predicate.FacingRight)
)
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.Info, function (sprite, otherSprite) {
while (sprite.overlapsWith(otherSprite)) {
sprite.x += 2
sprite.y += -2
}
changelogs()
})
function summon_snake () {
sprite_snake = sprites.create(img`
. . . . c c c c c c . . . . . .
. . . c 6 7 7 7 7 6 c . . . . .
. . c 7 7 7 7 7 7 7 7 c . . . .
. c 6 7 7 7 7 7 7 7 7 6 c . . .
. c 7 c 6 6 6 6 c 7 7 7 c . . .
. f 7 6 f 6 6 f 6 7 7 7 f . . .
. f 7 7 7 7 7 7 7 7 7 7 f . . .
. . f 7 7 7 7 6 c 7 7 6 f c . .
. . . f c c c c 7 7 6 f 7 7 c .
. . c 7 2 7 7 7 6 c f 7 7 7 7 c
. c 7 7 2 7 7 c f c 6 7 7 6 c c
c 1 1 1 1 7 6 f c c 6 6 6 c . .
f 1 1 1 1 1 6 6 c 6 6 6 6 f . .
f 6 1 1 1 1 1 6 6 6 6 6 c f . .
. f 6 1 1 1 1 1 1 6 6 6 f . . .
. . c c c c c c c c c f . . . .
`, SpriteKind.Enemy)
tp_to_random_spawner(sprite_snake)
sprites.setDataBoolean(sprite_snake, "see_player", false)
sprites.setDataNumber(sprite_snake, "see_cooldown", 10)
sprites.setDataNumber(sprite_snake, "damage_rate", 0)
sprites.setDataNumber(sprite_snake, "damage", -1)
sprites.setDataString(sprite_snake, "species", "snake")
character.loopFrames(
sprite_snake,
[img`
. . . . c c c c c c . . . . . .
. . . c 6 7 7 7 7 6 c . . . . .
. . c 7 7 7 7 7 7 7 7 c . . . .
. c 6 7 7 7 7 7 7 7 7 6 c . . .
. c 7 c 6 6 6 6 c 7 7 7 c . . .
. f 7 6 f 6 6 f 6 7 7 7 f . . .
. f 7 7 7 7 7 7 7 7 7 7 f . . .
. . f 7 7 7 7 6 c 7 7 6 f c . .
. . . f c c c c 7 7 6 f 7 7 c .
. . c 7 2 7 7 7 6 c f 7 7 7 7 c
. c 7 7 2 7 7 c f c 6 7 7 6 c c
c 1 1 1 1 7 6 f c c 6 6 6 c . .
f 1 1 1 1 1 6 6 c 6 6 6 6 f . .
f 6 1 1 1 1 1 6 6 6 6 6 c f . .
. f 6 1 1 1 1 1 1 6 6 6 f . . .
. . c c c c c c c c c f . . . .
`,img`
. . . c c c c c c . . . . . . .
. . c 6 7 7 7 7 6 c . . . . . .
. c 7 7 7 7 7 7 7 7 c . . . . .
c 6 7 7 7 7 7 7 7 7 6 c . . . .
c 7 c 6 6 6 6 c 7 7 7 c . . . .
f 7 6 f 6 6 f 6 7 7 7 f . . . .
f 7 7 7 7 7 7 7 7 7 7 f . . . .
. f 7 7 7 7 6 c 7 7 6 f . . . .
. . f c c c c 7 7 6 f c c c . .
. . c 6 2 7 7 7 f c c 7 7 7 c .
. c 6 7 7 2 7 7 c f 6 7 7 7 7 c
. c 1 1 1 1 7 6 6 c 6 6 6 c c c
. c 1 1 1 1 1 6 6 6 6 6 6 c . .
. c 6 1 1 1 1 1 6 6 6 6 6 c . .
. . c 6 1 1 1 1 1 7 6 6 c c . .
. . . c c c c c c c c c c . . .
`],
500,
character.rule(Predicate.MovingLeft)
)
character.loopFrames(
sprite_snake,
[img`
. . . . . . c c c c c c . . . .
. . . . . c 6 7 7 7 7 6 c . . .
. . . . c 7 7 7 7 7 7 7 7 c . .
. . . c 6 7 7 7 7 7 7 7 7 6 c .
. . . c 7 7 7 c 6 6 6 6 c 7 c .
. . . f 7 7 7 6 f 6 6 f 6 7 f .
. . . f 7 7 7 7 7 7 7 7 7 7 f .
. . c f 6 7 7 c 6 7 7 7 7 f . .
. c 7 7 f 6 7 7 c c c c f . . .
c 7 7 7 7 f c 6 7 7 7 2 7 c . .
c c 6 7 7 6 c f c 7 7 2 7 7 c .
. . c 6 6 6 c c f 6 7 1 1 1 1 c
. . f 6 6 6 6 c 6 6 1 1 1 1 1 f
. . f c 6 6 6 6 6 1 1 1 1 1 6 f
. . . f 6 6 6 1 1 1 1 1 1 6 f .
. . . . f c c c c c c c c c . .
`,img`
. . . . . . . c c c c c c . . .
. . . . . . c 6 7 7 7 7 6 c . .
. . . . . c 7 7 7 7 7 7 7 7 c .
. . . . c 6 7 7 7 7 7 7 7 7 6 c
. . . . c 7 7 7 c 6 6 6 6 c 7 c
. . . . f 7 7 7 6 f 6 6 f 6 7 f
. . . . f 7 7 7 7 7 7 7 7 7 7 f
. . . . f 6 7 7 c 6 7 7 7 7 f .
. . c c c f 6 7 7 c c c c f . .
. c 7 7 7 c c f 7 7 7 2 6 c . .
c 7 7 7 7 6 f c 7 7 2 7 7 6 c .
c c c 6 6 6 c 6 6 7 1 1 1 1 c .
. . c 6 6 6 6 6 6 1 1 1 1 1 c .
. . c 6 6 6 6 6 1 1 1 1 1 6 c .
. . c c 6 6 7 1 1 1 1 1 6 c . .
. . . c c c c c c c c c c . . .
`],
500,
character.rule(Predicate.MovingRight)
)
character.runFrames(
sprite_snake,
[img`
. . . . c c c c c c . . . . . .
. . . c 6 7 7 7 7 6 c . . . . .
. . c 7 7 7 7 7 7 7 7 c . . . .
. c 6 7 7 7 7 7 7 7 7 6 c . . .
. c 7 c 6 6 6 6 c 7 7 7 c . . .
. f 7 6 f 6 6 f 6 7 7 7 f . . .
. f 7 7 7 7 7 7 7 7 7 7 f . . .
. . f 7 7 7 7 6 c 7 7 6 f c . .
. . . f c c c c 7 7 6 f 7 7 c .
. . c 7 2 7 7 7 6 c f 7 7 7 7 c
. c 7 7 2 7 7 c f c 6 7 7 6 c c
c 1 1 1 1 7 6 f c c 6 6 6 c . .
f 1 1 1 1 1 6 6 c 6 6 6 6 f . .
f 6 1 1 1 1 1 6 6 6 6 6 c f . .
. f 6 1 1 1 1 1 1 6 6 6 f . . .
. . c c c c c c c c c f . . . .
`],
500,
character.rule(Predicate.FacingLeft, Predicate.NotMoving)
)
character.runFrames(
sprite_snake,
[img`
. . . . . . c c c c c c . . . .
. . . . . c 6 7 7 7 7 6 c . . .
. . . . c 7 7 7 7 7 7 7 7 c . .
. . . c 6 7 7 7 7 7 7 7 7 6 c .
. . . c 7 7 7 c 6 6 6 6 c 7 c .
. . . f 7 7 7 6 f 6 6 f 6 7 f .
. . . f 7 7 7 7 7 7 7 7 7 7 f .
. . c f 6 7 7 c 6 7 7 7 7 f . .
. c 7 7 f 6 7 7 c c c c f . . .
c 7 7 7 7 f c 6 7 7 7 2 7 c . .
c c 6 7 7 6 c f c 7 7 2 7 7 c .
. . c 6 6 6 c c f 6 7 1 1 1 1 c
. . f 6 6 6 6 c 6 6 1 1 1 1 1 f
. . f c 6 6 6 6 6 1 1 1 1 1 6 f
. . . f 6 6 6 1 1 1 1 1 1 6 f .
. . . . f c c c c c c c c c . .
`],
500,
character.rule(Predicate.FacingRight, Predicate.NotMoving)
)
}
sprites.onOverlap(SpriteKind.Player, SpriteKind.Artifact_Submit, function (sprite, otherSprite) {
while (sprite.overlapsWith(otherSprite)) {
sprite.y += 2
}