✨
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
["dragon", 1],
|
["dragon", 1],
|
||||||
["dwarf", 1],
|
["dwarf", 1],
|
||||||
["elf", 1],
|
["elf", 1],
|
||||||
|
["fight", 1],
|
||||||
["giant", 1],
|
["giant", 1],
|
||||||
["guard", 1],
|
["guard", 1],
|
||||||
["human", 1],
|
["human", 1],
|
||||||
@@ -127,7 +128,8 @@
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
"The Plan",
|
"The Plan",
|
||||||
"The party [trick/3] [Valindis/0+6] [Half-ear/0] by having [Cynthia/0] \"[capture/3]\" [Nix/0+6] [McGalloway/0] [disguised/3] as [Adrian/0+6] [Goldenleaf/0]."
|
"The party [trick/3] [Valindis/0+6] [Half-ear/0] by having [Cynthia/0] \"[capture/3]\" [Nix/0+6] [McGalloway/0] [disguised/3] as [Adrian/0+6] [Goldenleaf/0].",
|
||||||
|
"A [fight/1] starts, and they [kill/3] every member of the [purple/2] [rose/1]."
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
17
main.py
17
main.py
@@ -101,6 +101,8 @@ class Page():
|
|||||||
slots: list[tuple[list[str],WordSlot]]
|
slots: list[tuple[list[str],WordSlot]]
|
||||||
|
|
||||||
def solved(self):
|
def solved(self):
|
||||||
|
# print([s for s in self.slots])
|
||||||
|
|
||||||
if any([s[1].word is None for s in self.slots]):
|
if any([s[1].word is None for s in self.slots]):
|
||||||
return SolvedState.NotFinished
|
return SolvedState.NotFinished
|
||||||
elif all([s[1].word.word in s[0] for s in self.slots]):
|
elif all([s[1].word.word in s[0] for s in self.slots]):
|
||||||
@@ -110,6 +112,10 @@ class Page():
|
|||||||
else:
|
else:
|
||||||
return SolvedState.Wrong
|
return SolvedState.Wrong
|
||||||
|
|
||||||
|
def solve(self):
|
||||||
|
for answers, slot in self.slots:
|
||||||
|
slot.word = Word(answers[0],slot.colors[0],self,slot.position,slot)
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Word():
|
class Word():
|
||||||
word: str
|
word: str
|
||||||
@@ -542,7 +548,7 @@ def main(data: dict):
|
|||||||
if event.type == pygame.MOUSEBUTTONDOWN:
|
if event.type == pygame.MOUSEBUTTONDOWN:
|
||||||
click_slot()
|
click_slot()
|
||||||
i = focused()
|
i = focused()
|
||||||
if isinstance(i,int):
|
if isinstance(i,int) and pages[i-1].solved() == SolvedState.Correct:
|
||||||
page_sound = pygame.mixer.Sound("page.wav")
|
page_sound = pygame.mixer.Sound("page.wav")
|
||||||
page_sound.set_volume(0.7)
|
page_sound.set_volume(0.7)
|
||||||
page_sound.play()
|
page_sound.play()
|
||||||
@@ -552,6 +558,12 @@ def main(data: dict):
|
|||||||
elif event.type == pygame.QUIT:
|
elif event.type == pygame.QUIT:
|
||||||
running = False
|
running = False
|
||||||
|
|
||||||
|
key_state = pygame.key.get_pressed()
|
||||||
|
if key_state[pygame.K_SPACE] and key_state[pygame.K_LCTRL]:
|
||||||
|
pages[visible_page].solve()
|
||||||
|
for _,slot in pages[visible_page].slots:
|
||||||
|
words.append(slot.word)
|
||||||
|
|
||||||
# fill the screen with a color to wipe away anything from last frame
|
# fill the screen with a color to wipe away anything from last frame
|
||||||
drawer.fill("#4d2905")
|
drawer.fill("#4d2905")
|
||||||
|
|
||||||
@@ -586,6 +598,9 @@ def main(data: dict):
|
|||||||
|
|
||||||
# drawing tabs
|
# drawing tabs
|
||||||
for i in range(len(pages)-1):
|
for i in range(len(pages)-1):
|
||||||
|
if i != 0 and pages[i].solved() != SolvedState.Correct:
|
||||||
|
break
|
||||||
|
|
||||||
draw_tab(i,drawer,font,visible_page==i+1)
|
draw_tab(i,drawer,font,visible_page==i+1)
|
||||||
|
|
||||||
# drawing held word
|
# drawing held word
|
||||||
|
|||||||
Reference in New Issue
Block a user