-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBipoleV.py
5295 lines (4870 loc) · 225 KB
/
BipoleV.py
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
from faulthandler import disable
import tkinter as tk
from tkinter import dialog
from tkinter.filedialog import askopenfilename
from tkinter import *
import os
import time
import __main__
import maps
import characters
import equipment
import enemies
from PIL import Image
from PIL import ImageTk
import random
import pickle
import sys
current_directory = os.getcwd()
print(current_directory)
if True:
screen = tk.Tk()
screen['bg']='black'
screen.title('Bipole V: Dungeons of Biphero')
screen.unbind_all("<<NextWindow>>")
mainframe = tk.Frame(relief=tk.RAISED, bg='black')
mainfont = "Courier"
toprow = tk.Frame(master=mainframe, relief=tk.RAISED, bg='black')
toprow.grid(row=0, column=0)
save_button = tk.Button(master=toprow,text="SAVE",width=5,height=2,relief=RAISED, bg='black')
save_button.config(font=(mainfont,29),fg='red')
save_button.grid(row=0,column=0)
Gold = 500
filedisplay = tk.Label(master=toprow,text="Lemniscate Bipole V:\nDungeons of Biphero",anchor=CENTER,relief=tk.GROOVE,width=42,height=3, bg='black')
filedisplay.config(font=(mainfont,25),fg='magenta2')
filedisplay.grid(row=0, column=1)
topsidefram = tk.Frame(master=toprow, relief=tk.RAISED, bg='black')
topsidefram.grid(row=0,column=2)
sidestepping = False
sidestep_button = tk.Button(master=topsidefram,text="SIDE STEPPING\n(OFF)",width=16,height=2,relief=RAISED, bg='black')
sidestep_button.config(font=(mainfont,14),fg='white')
sidestep_button.grid(row=0,column=0)
topsidebotmfram = tk.Frame(master=topsidefram, relief=tk.RAISED, bg='black')
topsidebotmfram.grid(row=1,column=0)
stat_button = tk.Button(master=topsidebotmfram,text="STAT",width=5,height=2,relief=RAISED, bg='black')
stat_button.config(font=(mainfont,14),fg='cyan')
stat_button.grid(row=0,column=0)
key_button = tk.Button(master=topsidebotmfram,text="KEY ITEMS",width=10,height=2,relief=RAISED, bg='black')
key_button.config(font=(mainfont,14),fg='yellow')
key_button.grid(row=0,column=1)
centrow = tk.Frame(master=mainframe, relief=tk.RAISED, bg='black')
centrow.grid(row=1, column=0)
sprites_canvas = tk.Canvas(master=centrow, relief=tk.RIDGE, height=600,width=650,bg='black',borderwidth=-1)
sprites_canvas.grid(row=0,column=0)
world_color = "stone"
bottomest_layer = "brown"
dimensions = (650,600)
bottomest_background_sprite_unform = Image.open(str(current_directory)+"/world/"+world_color+"/bottomest_layer/"+bottomest_layer+".png").convert("RGBA")
bottomest_background_sprite = ImageTk.PhotoImage(bottomest_background_sprite_unform.resize(dimensions,resample=Image.NEAREST))
bottomest_background_image = sprites_canvas.create_image(0, 0, anchor=NW, image=bottomest_background_sprite)
# bottomerer_background_sprites_sides = []
# bottomerer_background_images_sides = []
# ind = 0
# for x in range(4):
# bottomerer_background_sprites_sides.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottomerer_layer/"+"0000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST)))
# bottomerer_background_images_sides.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottomerer_background_sprites_sides[ind]))
# ind += 1
bottomerer_background_sprite = ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottomerer_layer/"+"1111"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST))
bottomerer_background_image = sprites_canvas.create_image(0, 0, anchor=NW, image=bottomerer_background_sprite)
# bottomerer_background_sprites = []
# bottomerer_background_images = []
# bottomerer_background_sprite_unform10000 = Image.open(str(current_directory)+"/world/"+world_color+"/bottomerer_layer/"+"0100"+".png").convert("RGBA")
# bottomerer_background_sprite10000 = ImageTk.PhotoImage(bottomerer_background_sprite_unform10000.resize(dimensions,resample=Image.NEAREST))
# bottomerer_background_sprites.append(bottomerer_background_sprite10000)
# bottomerer_background_images.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottomerer_background_sprite10000))
# bottomerer_background_sprite_unform01000 = Image.open(str(current_directory)+"/world/"+world_color+"/bottomerer_layer/"+"0000"+".png").convert("RGBA")
# bottomerer_background_sprite01000 = ImageTk.PhotoImage(bottomerer_background_sprite_unform01000.resize(dimensions,resample=Image.NEAREST))
# bottomerer_background_sprites.append(bottomerer_background_sprite01000)
# bottomerer_background_images.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottomerer_background_sprite01000))
# bottomerer_background_sprite_unform00100 = Image.open(str(current_directory)+"/world/"+world_color+"/bottomerer_layer/"+"1000"+".png").convert("RGBA")
# bottomerer_background_sprite00100 = ImageTk.PhotoImage(bottomerer_background_sprite_unform00100.resize(dimensions,resample=Image.NEAREST))
# bottomerer_background_sprites.append(bottomerer_background_sprite00100)
# bottomerer_background_images.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottomerer_background_sprite00100))
# bottomerer_background_sprite_unform00010 = Image.open(str(current_directory)+"/world/"+world_color+"/bottomerer_layer/"+"0001"+".png").convert("RGBA")
# bottomerer_background_sprite00010 = ImageTk.PhotoImage(bottomerer_background_sprite_unform00010.resize(dimensions,resample=Image.NEAREST))
# bottomerer_background_sprites.append(bottomerer_background_sprite00010)
# bottomerer_background_images.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottomerer_background_sprite00010))
bottomer_background_sprite = ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottomer_layer/"+"01110"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST))
bottomer_background_image = sprites_canvas.create_image(0, 0, anchor=NW, image=bottomer_background_sprite)
# bottomer_background_sprites_sides = []
# bottomer_background_images_sides = []
# ind = 0
# for x in range(5):
# bottomer_background_sprites_sides.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottomer_layer/"+"00000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST)))
# bottomer_background_images_sides.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottomer_background_sprites_sides[ind]))
# ind += 1
# bottomer_background_sprites = []
# bottomer_background_images = []
# ind = 0
# for x in range(5):
# bottomer_background_sprites.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottomer_layer/"+"00000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST)))
# bottomer_background_images.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottomer_background_sprites[ind]))
# ind += 1
bottomerspr = [0]
bottomerimg = [0]
bottomerspr.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/sprites/"+"protipole"+".png").convert("RGBA").resize((100,250),resample=Image.NEAREST)))
bottomerimg.append(sprites_canvas.create_image(50+90, 310, anchor=CENTER, image=bottomerspr[1]))
bottomerspr.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/sprites/"+"protipole"+".png").convert("RGBA").resize((60,175),resample=Image.NEAREST)))
bottomerimg.append(sprites_canvas.create_image(325, 290, anchor=CENTER, image=bottomerspr[2]))
bottomerspr.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/sprites/"+"protipole"+".png").convert("RGBA").resize((100,250),resample=Image.NEAREST)))
bottomerimg.append(sprites_canvas.create_image(625-90, 310, anchor=CENTER, image=bottomerspr[3]))
bottomerspr.append(0)
bottomerimg.append(0)
# bottom_background_sprites_sides = []
# bottom_background_images_sides = []
# ind = 0
# for x in range(5):
# bottom_background_sprites_sides.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottom_layer/"+"00000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST)))
# bottom_background_images_sides.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottom_background_sprites_sides[ind]))
# ind += 1
# bottom_background_sprites = []
# bottom_background_images = []
# ind = 0
# for x in range(5):
# bottom_background_sprites.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottom_layer/"+"00000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST)))
# bottom_background_images.append(sprites_canvas.create_image(0, 0, anchor=NW, image=bottom_background_sprites[ind]))
# ind += 1
bottom_background_sprite = ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/bottom_layer/"+"111"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST))
bottom_background_image = sprites_canvas.create_image(0, 0, anchor=NW, image=bottom_background_sprite)
bottomspr = [0]
bottomimg = [0]
mul = 1
bottomspr.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/sprites/"+"nothing"+".png").convert("RGBA").resize((165,420),resample=Image.NEAREST)))
bottomimg.append(sprites_canvas.create_image(50, 320, anchor=CENTER, image=bottomspr[1]))
bottomspr.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/sprites/"+"nothing"+".png").convert("RGBA").resize((100,250),resample=Image.NEAREST)))
bottomimg.append(sprites_canvas.create_image(325, 310, anchor=CENTER, image=bottomspr[2]))
bottomspr.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/sprites/"+"nothing"+".png").convert("RGBA").resize((165,420),resample=Image.NEAREST)))
bottomimg.append(sprites_canvas.create_image(625, 320, anchor=CENTER, image=bottomspr[3]))
bottomspr.append(0)
bottomimg.append(0)
# top_background_sprites_sides = []
# top_background_images_sides = []
# ind = 0
# for x in range(3):
# top_background_sprites_sides.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/top_layer/"+"000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST)))
# top_background_images_sides.append(sprites_canvas.create_image(0, 0, anchor=NW, image=top_background_sprites_sides[ind]))
# ind += 1
# top_background_sprites = []
# top_background_images = []
# ind = 0
# for x in range(3):
# top_background_sprites.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/top_layer/"+"000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST)))
# top_background_images.append(sprites_canvas.create_image(0, 0, anchor=NW, image=top_background_sprites[ind]))
# ind += 1
top_background_sprite = ImageTk.PhotoImage(Image.open(str(current_directory)+"/world/"+world_color+"/top_layer/"+"000"+".png").convert("RGBA").resize(dimensions,resample=Image.NEAREST))
top_background_image = sprites_canvas.create_image(0, 0, anchor=NW, image=top_background_sprite)
topspr = [0]
topimg = [0]
topspr.append(ImageTk.PhotoImage(Image.open(str(current_directory)+"/sprites/"+"nothing"+".png").convert("RGBA").resize((165,420),resample=Image.NEAREST)))
topimg.append(sprites_canvas.create_image(325, 320, anchor=CENTER, image=topspr[1]))
key_background_unform = Image.open(str(current_directory)+"/sprites/"+"nothing"+".png").convert("RGBA")
key_background_sprite = ImageTk.PhotoImage(key_background_unform.resize((650,600),resample=Image.NEAREST))
key_background_image = sprites_canvas.create_image(0, 0, anchor=NW, image=key_background_sprite)
char1_background_sprite_unform = Image.open(str(current_directory)+"/sprites/"+"nothing"+".png").convert("RGBA")
character_sprite1 = ImageTk.PhotoImage(char1_background_sprite_unform.resize((200,500),resample=Image.NEAREST))
character_image1 = sprites_canvas.create_image(100, 362, anchor=CENTER, image=character_sprite1)
# character_sprite1 = PhotoImage(file = str(current_directory)+"/sprites/"+"bipoanderer.gif")
# character_image1 = sprites_canvas.create_image(100, 362, anchor=CENTER, image=character_sprite1)
char2_background_sprite_unform = Image.open(str(current_directory)+"/sprites/"+"protipole"+".png").convert("RGBA")
character_sprite2 = ImageTk.PhotoImage(char2_background_sprite_unform.resize((200,500),resample=Image.NEAREST))
character_image2 = sprites_canvas.create_image(325, 362, anchor=CENTER, image=character_sprite2)
# character_sprite2 = PhotoImage(file = str(current_directory)+"/sprites/"+"protipole.gif")
# character_image2 = sprites_canvas.create_image(325, 362, anchor=CENTER, image=character_sprite2)
char3_background_sprite_unform = Image.open(str(current_directory)+"/sprites/"+"nothing"+".png").convert("RGBA")
character_sprite3 = ImageTk.PhotoImage(char3_background_sprite_unform.resize((200,500),resample=Image.NEAREST))
character_image3 = sprites_canvas.create_image(550, 362, anchor=CENTER, image=character_sprite3)
dialouge = tk.Label(master=centrow, text="Lemniscate Bipole V:\nDungeons of Biphero\n\nMade by infinityJKA\n\n----------\n\n[A] Load Save\n[B] New Game\n\n----------\n\nRead README.txt before playing\n\n(Release v1.0)\ninfinityjka.itch.io", relief=tk.FLAT,width=50,height=30, bg='black')
dialouge.config(font=(mainfont,12),fg='white')
dialouge.grid(row=0,column=1)
botrow = tk.Frame(master=mainframe, relief=tk.RAISED, bg='black')
botrow.grid(row=2, column=0)
# protagimg = PhotoImage(file="bipoleii_100x100.png")
# protagportrait = tk.Label(master=botrow, image=protagimg,relief=tk.RIDGE,width=150,height=150)
# protagportrait.grid(row=0,column=0)
# img = None
# portrait.config(image=img)
# protagimg = None
# protagportrait.config(image=img)
party_frame = tk.Frame(master=botrow, relief=tk.RAISED, bg='black')
party_frame.grid(row=0, column=0)
party_font = 12
party_member1 = tk.Label(master=party_frame, text="=EMPTY=", relief=tk.SUNKEN,width=51,height=2, bg='black')
party_member1.config(font=(mainfont,party_font),fg='green2')
party_member1.grid(row=0,column=0)
party_member2 = tk.Label(master=party_frame, text="=EMPTY=", relief=tk.SUNKEN,width=51,height=2, bg='black')
party_member2.config(font=(mainfont,party_font),fg='green2')
party_member2.grid(row=1,column=0)
party_member3 = tk.Label(master=party_frame, text="=EMPTY=", relief=tk.SUNKEN,width=51,height=2, bg='black')
party_member3.config(font=(mainfont,party_font),fg='green2')
party_member3.grid(row=2,column=0)
party_member4 = tk.Label(master=party_frame, text="=EMPTY=", relief=tk.SUNKEN,width=51,height=2, bg='black')
party_member4.config(font=(mainfont,party_font),fg='green2')
party_member4.grid(row=3,column=0)
buttons_frame = tk.Frame(master=botrow,relief=tk.FLAT, bg='black')
buttons_frame.grid(row=0,column=1)
# HP = 5
# healthdisplay = tk.Label(master=lowerframe,text="HP 5/5",width=7,height=2,anchor=W)#("HP:",str(HP)+"/5"))
# healthdisplay.config(font=(mainfont,40))
# healthdisplay.grid(row=0,column=0)
button_color = "black" #"grey6"
a_button = tk.Button(master=buttons_frame,text="A",width=5,height=2,relief=RAISED, bg=button_color)
a_button.config(font=(mainfont,20),fg='dodger blue')
a_button.grid(row=0,column=0)
up_button = tk.Button(master=buttons_frame,text="△",width=5,height=2,relief=RAISED, bg=button_color)
up_button.config(font=(mainfont,20),fg='white')
up_button.grid(row=0,column=1)
b_button = tk.Button(master=buttons_frame,text="B",width=5,height=2,relief=RAISED, bg=button_color)
b_button.config(font=(mainfont,20),fg='red')
b_button.grid(row=0,column=2)
equip_button = tk.Button(master=buttons_frame,text="EQUIP",width=5,height=2,relief=RAISED, bg=button_color)
equip_button.config(font=(mainfont,20),fg='yellow')
equip_button.grid(row=0,column=3)
party_button = tk.Button(master=buttons_frame,text="PARTY",width=5,height=2,relief=RAISED, bg=button_color)
party_button.config(font=(mainfont,20),fg='yellow')
party_button.grid(row=0,column=4)
item_button = tk.Button(master=buttons_frame,text="ITEM",width=5,height=2,relief=RAISED, bg=button_color)
item_button.config(font=(mainfont,20),fg='yellow')
item_button.grid(row=1,column=3)
talk_button = tk.Button(master=buttons_frame,text="TALK",width=5,height=2,relief=RAISED, bg=button_color)
talk_button.config(font=(mainfont,20),fg='yellow')
talk_button.grid(row=1,column=4)
left_button = tk.Button(master=buttons_frame,text="◁",width=5,height=2,relief=RAISED, bg=button_color)
left_button.config(font=(mainfont,20),fg='white')
left_button.grid(row=1,column=0)
down_button = tk.Button(master=buttons_frame,text="▽",width=5,height=2,relief=RAISED, bg=button_color)
down_button.config(font=(mainfont,20),fg='white')
down_button.grid(row=1,column=1)
right_button = tk.Button(master=buttons_frame,text="▷",width=5,height=2,relief=RAISED, bg=button_color)
right_button.config(font=(mainfont,20),fg='white')
right_button.grid(row=1,column=2)
minimap_frame = tk.Frame(master=botrow,relief=tk.RAISED,bg="black")
minimap_frame.grid(row=0,column=2)
minimap_width = 2
minimap_height = 1
minimap_fontsize = 20
minimap_default_color = "black"
minimap_text_color = "magenta2"
minimap_00 = tk.Label(master=minimap_frame, text="x", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_00.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_00.grid(row=0,column=0)
minimap_10 = tk.Label(master=minimap_frame, text="x", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_10.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_10.grid(row=1,column=0)
minimap_20 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_20.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_20.grid(row=2,column=0)
minimap_30 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_30.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_30.grid(row=3,column=0)
minimap_40 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_40.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_40.grid(row=4,column=0)
minimap_01 = tk.Label(master=minimap_frame, text="x", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_01.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_01.grid(row=0,column=1)
minimap_11 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_11.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_11.grid(row=1,column=1)
minimap_21 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_21.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_21.grid(row=2,column=1)
minimap_31 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_31.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_31.grid(row=3,column=1)
minimap_41 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_41.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_41.grid(row=4,column=1)
minimap_02 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_02.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_02.grid(row=0,column=2)
minimap_12 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_12.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_12.grid(row=1,column=2)
minimap_22 = tk.Label(master=minimap_frame, text="△", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_22.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_22.grid(row=2,column=2)
minimap_32 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_32.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_32.grid(row=3,column=2)
minimap_42 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_42.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_42.grid(row=4,column=2)
minimap_03 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_03.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_03.grid(row=0,column=3)
minimap_13 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_13.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_13.grid(row=1,column=3)
minimap_23 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_23.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_23.grid(row=2,column=3)
minimap_33 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_33.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_33.grid(row=3,column=3)
minimap_43 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_43.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_43.grid(row=4,column=3)
minimap_04 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_04.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_04.grid(row=0,column=4)
minimap_14 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_14.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_14.grid(row=1,column=4)
minimap_24 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_24.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_24.grid(row=2,column=4)
minimap_34 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_34.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_34.grid(row=3,column=4)
minimap_44 = tk.Label(master=minimap_frame, text="X", relief=tk.SUNKEN,width=minimap_width,height=minimap_height)
minimap_44.config(font=(mainfont,minimap_fontsize),bg=minimap_default_color,fg=minimap_text_color)
minimap_44.grid(row=4,column=4)
vision_facing = "North"
mainframe.pack()
else:
print("how")
def clear_all_character_sprites():
set_character_sprite(1,"nothing")
set_character_sprite(2,"nothing")
set_character_sprite(3,"nothing")
# global character_sprite2
# character_sprite2 = PhotoImage(file = str(current_directory)+"/sprites/nothing")
# sprites_canvas.itemconfig(character_image2,image=character_sprite2)
# global character_sprite3
# character_sprite3 = PhotoImage(file = str(current_directory)+"/sprites/nothing")
# sprites_canvas.itemconfig(character_image3,image=character_sprite3)
print("all character sprites cleared")
def clear_sprite(num):
if num == 1:
print("cleared 1")
global character_sprite1
character_sprite1 = PhotoImage(file = str(current_directory)+"/sprites/nothing.png")
sprites_canvas.itemconfig(character_image1,image=character_sprite1)
elif num == 2:
print("cleared 2")
global character_sprite2
character_sprite2 = PhotoImage(file = str(current_directory)+"/sprites/nothing.png")
sprites_canvas.itemconfig(character_image2,image=character_sprite2)
elif num == 3:
print("cleard 3")
global character_sprite3
character_sprite3 = PhotoImage(file = str(current_directory)+"/sprites/nothing.png")
sprites_canvas.itemconfig(character_image3,image=character_sprite3)
def set_character_sprite(position,sprite):
if position == 1:
global char1_background_sprite_unform
global character_sprite1
char1_background_sprite_unform = Image.open(str(current_directory)+"/sprites/"+sprite+".png").convert("RGBA")
character_sprite1 = ImageTk.PhotoImage(char1_background_sprite_unform.resize((200,500),resample=Image.NEAREST))
sprites_canvas.itemconfig(character_image1, image = character_sprite1)
print("character sprite 1 changed")
elif position == 2:
global char2_background_sprite_unform
global character_sprite2
char2_background_sprite_unform = Image.open(str(current_directory)+"/sprites/"+sprite+".png").convert("RGBA")
character_sprite2 = ImageTk.PhotoImage(char2_background_sprite_unform.resize((200,500),resample=Image.NEAREST))
sprites_canvas.itemconfig(character_image2, image = character_sprite2)
print("character sprite 2 changed")
elif position == 3:
global char3_background_sprite_unform
global character_sprite3
char3_background_sprite_unform = Image.open(str(current_directory)+"/sprites/"+sprite+".png").convert("RGBA")
character_sprite3 = ImageTk.PhotoImage(char3_background_sprite_unform.resize((200,500),resample=Image.NEAREST))
sprites_canvas.itemconfig(character_image3, image = character_sprite3)
print("character sprite 3 changed")
else:
print("ERROR ON set_character_sprite")
def set_big_character_sprite(sprite):
global character_sprite2
char2_background_sprite_unform = Image.open(str(current_directory)+"/sprites/"+sprite+".png").convert("RGBA")
character_sprite2 = ImageTk.PhotoImage(char2_background_sprite_unform.resize((600,500),resample=Image.NEAREST))
sprites_canvas.itemconfig(character_image2, image = character_sprite2)
print("character sprite 2 changed (big)")
def set_key_background(sprite):
global key_background_sprite
key_background_unform = Image.open(str(current_directory)+"/sprites/"+sprite+".png").convert("RGBA")
key_background_sprite = ImageTk.PhotoImage(key_background_unform.resize((650,600),resample=Image.NEAREST))
sprites_canvas.itemconfig(key_background_image, image = key_background_sprite)
print("set key background to \""+sprite+"\"")
def turn_right():
global vision_facing
if vision_facing == "North":
vision_facing = "East"
print("now facing east")
elif vision_facing == "East":
vision_facing = "South"
print("now facing south")
elif vision_facing == "South":
vision_facing = "West"
print("now facing west")
elif vision_facing == "West":
vision_facing = "North"
print("now facing north")
else:
print("ERROR ON turn_right")
refresh()
def turn_left():
global vision_facing
if vision_facing == "North":
vision_facing = "West"
print("now facing west")
elif vision_facing == "West":
vision_facing = "South"
print("now facing south")
elif vision_facing == "South":
vision_facing = "East"
print("now facing east")
elif vision_facing == "East":
vision_facing = "North"
print("now facing north")
else:
print("ERROR ON turn_left")
refresh()
def sidestep_toggle():
global sidestepping
if sidestepping == True:
sidestepping = False
sidestep_button.config(text="SIDE STEPPING\n(OFF)")
print("side stepping disabled")
elif sidestepping == False:
sidestepping = True
sidestep_button.config(text="SIDE STEPPING\n(ON)")
print("side stepping enabled")
def nothing():
#Bipole II: Trials developement status type beat amerite?
pass
def disable_inputs():
disable_keys()
save_button.config(command=nothing)
sidestep_button.config(command=nothing)
stat_button.config(command=nothing)
a_button.config(command=nothing)
b_button.config(command=nothing)
up_button.config(command=nothing)
down_button.config(command=nothing)
left_button.config(command=nothing)
right_button.config(command=nothing)
equip_button.config(command=nothing)
party_button.config(command=nothing)
item_button.config(command=nothing)
talk_button.config(command=nothing)
key_button.config(command=nothing)
def write_text(the_text):
dialouge.config(text=the_text)
def clear_text():
dialouge.config(text="")
def newgame():
disable_inputs()
clear_all_character_sprites()
def toggle_sidestep_button(yesno):
global two_command
if yesno == True:
sidestep_button.config(command=sidestep_toggle)
two_command = "sidestep_toggle()"
elif yesno == False:
sidestep_button.config(command=nothing)
two_command = "nothing()"
q_command = "nothing()"
a_command = "nothing()"
w_command = "nothing()"
s_command = "nothing()"
e_command = "nothing()"
d_command = "nothing()"
r_command = "nothing()"
f_command = "nothing()"
t_command = "nothing()"
g_command = "nothing()"
one_command = "nothing()"
two_command = "nothing()"
three_command = "nothing()"
four_command = "nothing()"
space_command = "nothing()"
up_command = "nothing()"
down_command = "nothing()"
left_command = "nothing()"
right_command = "nothing()"
def key_input(e):
#print(e.char)
print(e)
if e.char == "q":
global q_command
eval(q_command+"")
elif e.char == "a":
global a_command
eval(a_command+"")
elif e.char == "w":
global w_command
eval(w_command+"")
elif e.char == "s":
global s_command
eval(s_command+"")
elif e.char == "e":
global e_command
eval(e_command+"")
elif e.char == "d":
global d_command
eval(d_command+"")
elif e.char == "r":
global r_command
eval(r_command+"")
elif e.char == "f":
global f_command
eval(f_command+"")
elif e.char == "t":
global t_command
eval(t_command+"")
elif e.char == "g":
global g_command
eval(g_command+"")
elif e.char == "1":
global one_command
eval(one_command+"")
elif e.char == "2":
global two_command
eval(two_command+"")
elif e.char == "3":
global three_command
eval(three_command+"")
elif e.char == "4":
global four_command
eval(four_command+"")
elif e.char == " ":
global space_command
eval(space_command+"")
elif e.keysym == "Up":
global up_command
eval(up_command+"")
elif e.keysym == "Down":
global down_command
eval(down_command+"")
elif e.keysym == "Left":
global left_command
eval(left_command+"")
elif e.keysym == "Right":
global right_command
eval(right_command+"")
else:
print("unused key")
def disable_keys():
global q_command
global a_command
global w_command
global s_command
global e_command
global d_command
global r_command
global f_command
global t_command
global g_command
global one_command
global two_command
global three_command
global four_command
global space_command
global up_command
global down_command
global left_command
global right_command
q_command = "nothing()"
a_command = "nothing()"
w_command = "nothing()"
s_command = "nothing()"
e_command = "nothing()"
d_command = "nothing()"
r_command = "nothing()"
f_command = "nothing()"
t_command = "nothing()"
g_command = "nothing()"
one_command = "nothing()"
two_command = "nothing()"
three_command = "nothing()"
four_command = "nothing()"
space_command = "nothing()"
up_command = "nothing()"
down_command = "nothing()"
left_command = "nothing()"
right_command = "nothing()"
dialogue = ["install","bipole"]
dialogue_index = 1
def start_dialogue(input_file):
disable_inputs()
global dialogue
global dialogue_index
dialogue_index = 1
file_contents = open(current_directory+"/dialogue/"+maps.current_location[4]+"/"+input_file+".txt")
dialogue = [line.rstrip('\n') for line in file_contents]
print(dialogue)
perform_dialogue()
def start_dialogue_direct(input_file):
disable_inputs()
global dialogue
global dialogue_index
dialogue_index = 1
file_contents = open(current_directory+input_file)
dialogue = [line.rstrip('\n') for line in file_contents]
print(dialogue)
perform_dialogue()
in_shop_list = False
shop_inventory = []
shop_end_index = 0
pawn_current = "equip"
pawn_mul = 0.5
multichoice_index = 0
multichoice_list = []
def perform_dialogue():
disable_inputs()
global dialogue
global dialogue_index
global space_command
global g_command
global yes_no_result
global Gold
global vision_facing
global in_shop_list
global shop_inventory
global text_to_use_in_multi
global temporary_text_to_use_in_multi
global list_to_use_in_multi
global multi_use_displayname
global equip_stat_return_to
global multiselect_index
global mutliselect_buying
global shop_end_index
global item_stat_return_to
global up_command
global w_command
global down_command
global s_command
global e_command
global q_command
global left_command
global a_command
global right_command
global d_command
global r_command
global multi_char_stat_to_show
global pawn_current
global pawn_mul
global current_encounter
global current_encounter_all
global battle_during_cutscene
global current_encounter_all
global current_encounter
global did_move
global multichoice_index
global multichoice_list
line = (dialogue[dialogue_index])
if line == "#CLEAR":
clear_all_character_sprites()
dialogue_index += 1
perform_dialogue()
elif "#SET_IMAGE " in line:
set_character_sprite(2,line.replace('#SET_IMAGE ',''))
dialogue_index += 1
perform_dialogue()
elif "#SET_BIG_IMAGE " in line:
set_big_character_sprite(line.replace('#SET_BIG_IMAGE ',''))
dialogue_index += 1
perform_dialogue()
elif "#SET_KEY_BACK " in line:
set_key_background(line.replace('#SET_KEY_BACK ',''))
dialogue_index += 1
perform_dialogue()
elif line == "#END":
refresh()
elif line == "#END_KEY_ITEM":
open_key_items()
elif "#OPEN_DIALG " in line:
thing = line.replace('#OPEN_DIALG ','')
dialogue_index = 0
file_contents = open(current_directory+"/dialogue/key_items/"+thing+".txt")
dialogue = [line.rstrip('\n') for line in file_contents]
print(dialogue)
perform_dialogue()
elif line == "_" or line == "-pass-" or "/==/." in line:
dialogue_index += 1
perform_dialogue()
elif "#CHOICE " in line:
dialogue_index += 1
write_text(line.replace('#CHOICE ','').replace('[@]',"\n"))
yes_no_controls()
elif line == "#CHOICE_RESULT":
if yes_no_result == False:
dialogue_index += 1
perform_dialogue()
else:
dialogue_index += 6
perform_dialogue()
elif line == "#CHOICE_RESULT_GO_TO":
if yes_no_result == True:
thing = dialogue[dialogue_index+1]
else:
thing = dialogue[dialogue_index+2]
dialogue_index = search_for("/==/."+thing)
perform_dialogue()
elif "#SENDIFEQUIPMENT " in line:
thing_to_check = getattr(equipment,line.replace('#SENDIFEQUIPMENT ',''))
has = False
for e in equipment.equipment_inventory:
if e.DisplayName == thing_to_check.DisplayName:
has = True
if has:
goto = dialogue[dialogue_index+1]
print("HAS EQUIPMENT")
else:
goto = dialogue[dialogue_index+2]
print("DOESN'T HAVE EQUIPMENT")
dialogue_index = search_for("/==/."+goto)
perform_dialogue()
if Gold >= amount:
thing = dialogue[dialogue_index+1]
else:
thing = dialogue[dialogue_index+2]
dialogue_index = search_for("/==/."+thing)
perform_dialogue()
elif "#REMOVE_EQUIPMENT" in line:
thing_to_get = getattr(equipment,line.replace('#REMOVE_EQUIPMENT ',''))
removed = False
for e in equipment.equipment_inventory:
if e.DisplayName == thing_to_get.DisplayName:
if removed == False:
equipment.equipment_inventory.remove(e)
print("removed equipment")
removed = True
if removed == False:
print("didn't remove equipment (couldn't find)")
dialogue_index += 1
advance_text()
elif "#SENDIFGOLD>= " in line:
amount = (int)(line.replace("#SENDIFGOLD>= ",""))
if Gold >= amount:
thing = dialogue[dialogue_index+1]
else:
thing = dialogue[dialogue_index+2]
dialogue_index = search_for("/==/."+thing)
perform_dialogue()
elif "#SENDIFKEYITEM " in line:
keytocheck = getattr(equipment,line.replace('#SENDIFKEYITEM ',''))
haskey = False
for k in equipment.key_item_inventory:
if k.DisplayName == keytocheck.DisplayName:
haskey = True
print(k.DisplayName+" is "+ keytocheck.DisplayName)
else:
print(k.DisplayName+" isn't "+ keytocheck.DisplayName)
if haskey:
thing = dialogue[dialogue_index+1]
print("HAS KEY ITEM")
else:
thing = dialogue[dialogue_index+2]
print("DOESN'T HAVE KEY ITEM")
dialogue_index = search_for("/==/."+thing)
perform_dialogue()
elif line == "#DESTROY_SELF":
cords = maps.return_player_cords()
maps.current_location[1][cords[1]][cords[0]] = ["000"]
did_move = False
refresh()
elif "#OVERRIDE_SELF" in line:
cords = maps.return_player_cords()
maps.current_location[1][cords[1]][cords[0]] = [line.replace('#OVERRIDE_SELF ','')]
did_move = False
refresh()
elif line == "#RECRUIT":
dialogue_index += 1
line = (dialogue[dialogue_index])
characters.All_Recruited_Characters.append(eval("characters."+line))
if len(characters.Current_Party) < 4:
characters.Current_Party.append(eval("characters."+line))
else:
characters.Unequipped_Characters.append(eval("characters."+line))
dialogue_index += 1
perform_dialogue()
elif "#GAIN_KEYITEM" in line:
thing_to_get = getattr(equipment,line.replace('#GAIN_KEYITEM ',''))
equipment.key_item_inventory.append(thing_to_get)
dialogue_index += 1
write_text("Obtained "+thing_to_get.DisplayName+"!\n["+thing_to_get.DisplayName+" was added to your KEY ITEMS]")
space_command = "advance_text()"
g_command = "advance_text()"
talk_button.config(command=advance_text)
elif "#REMOVE_KEYITEM" in line:
thing_to_get = getattr(equipment,line.replace('#REMOVE_KEYITEM ',''))
removed = False
for k in equipment.key_item_inventory:
if k.DisplayName == thing_to_get.DisplayName:
if removed == False:
equipment.key_item_inventory.remove(k)
print("removed key item")
removed = True
if removed == False:
print("didn't remove key item (couldn't find)")
dialogue_index += 1
advance_text()
elif "#GAIN_EQUIPMENT " in line:
if len(equipment.equipment_inventory) < 20:
thing_to_get = getattr(equipment,line.replace('#GAIN_EQUIPMENT ',''))
equipment.equipment_inventory.append(thing_to_get)
dialogue_index += 1
write_text("Obtained "+thing_to_get.DisplayName+"!")
space_command = "advance_text()"
g_command = "advance_text()"
talk_button.config(command=advance_text)
else:
write_text("Equipment inventory is full,\ncannot obtain item.")
dialogue_index = 0
space_command = "refresh()"
g_command = "refresh()"
talk_button.config(command=refresh)
elif "#GAIN_ITEM " in line:
if len(equipment.item_inventory) < 20:
thing_to_get = getattr(equipment,line.replace('#GAIN_ITEM ',''))
equipment.item_inventory.append(thing_to_get)
dialogue_index += 1
write_text("Obtained "+thing_to_get.DisplayName+"!")
space_command = "advance_text()"
g_command = "advance_text()"
talk_button.config(command=advance_text)