✨
This commit is contained in:
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -135,7 +135,8 @@ def draw_page(page: Page, screen: pygame.surface.Surface, font: pygame.font.Font
|
|||||||
page.position.y + PAGE_BORDER_WIDTH,
|
page.position.y + PAGE_BORDER_WIDTH,
|
||||||
page.size.x - PAGE_BORDER_WIDTH*2,
|
page.size.x - PAGE_BORDER_WIDTH*2,
|
||||||
page.size.y - PAGE_BORDER_WIDTH*2
|
page.size.y - PAGE_BORDER_WIDTH*2
|
||||||
)
|
),
|
||||||
|
border_radius=PAGE_BORDER_RADIUS//2
|
||||||
)
|
)
|
||||||
|
|
||||||
pygame.draw.rect(
|
pygame.draw.rect(
|
||||||
@@ -183,6 +184,26 @@ def draw_page(page: Page, screen: pygame.surface.Surface, font: pygame.font.Font
|
|||||||
INDICATOR_SIZE-INDICATOR_BORDER
|
INDICATOR_SIZE-INDICATOR_BORDER
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def play_sound(page: Page):
|
||||||
|
click = pygame.mixer.Sound("click.wav")
|
||||||
|
click.set_volume(0.8)
|
||||||
|
click.play()
|
||||||
|
|
||||||
|
if page.slots != []:
|
||||||
|
status = page.solved()
|
||||||
|
if status == SolvedState.Correct:
|
||||||
|
sound = pygame.mixer.Sound("correct.wav")
|
||||||
|
elif status == SolvedState.AlmostCorrect:
|
||||||
|
sound = pygame.mixer.Sound("incorrect.wav")
|
||||||
|
elif status == SolvedState.Wrong:
|
||||||
|
sound = pygame.mixer.Sound("incorrect.wav")
|
||||||
|
else:
|
||||||
|
return
|
||||||
|
|
||||||
|
sound.play()
|
||||||
|
|
||||||
|
|
||||||
def draw_word_slot(word_slot: WordSlot, screen: pygame.surface.Surface):
|
def draw_word_slot(word_slot: WordSlot, screen: pygame.surface.Surface):
|
||||||
pos = word_slot.page.position+word_slot.position
|
pos = word_slot.page.position+word_slot.position
|
||||||
|
|
||||||
@@ -324,6 +345,12 @@ def draw_tab(n: int, screen: pygame.surface.Surface, font: pygame.font.Font, sel
|
|||||||
def main(data: dict):
|
def main(data: dict):
|
||||||
pygame.init()
|
pygame.init()
|
||||||
pygame.font.init()
|
pygame.font.init()
|
||||||
|
|
||||||
|
# music
|
||||||
|
pygame.mixer.music.load("Slight Delay.mp3")
|
||||||
|
pygame.mixer.music.set_volume(0.1)
|
||||||
|
pygame.mixer.music.play(-1)
|
||||||
|
|
||||||
font = pygame.font.SysFont("Comic Code",WORD_FONT_SIZE,True)
|
font = pygame.font.SysFont("Comic Code",WORD_FONT_SIZE,True)
|
||||||
print(font.size(WORD_SLOT_SPACING))
|
print(font.size(WORD_SLOT_SPACING))
|
||||||
screen = pygame.display.set_mode((1280, 720),pygame.RESIZABLE)
|
screen = pygame.display.set_mode((1280, 720),pygame.RESIZABLE)
|
||||||
@@ -505,6 +532,8 @@ def main(data: dict):
|
|||||||
|
|
||||||
held_word = None
|
held_word = None
|
||||||
|
|
||||||
|
play_sound(slot.page)
|
||||||
|
|
||||||
|
|
||||||
while running:
|
while running:
|
||||||
for event in pygame.event.get():
|
for event in pygame.event.get():
|
||||||
@@ -512,6 +541,9 @@ def main(data: dict):
|
|||||||
click_slot()
|
click_slot()
|
||||||
i = focused()
|
i = focused()
|
||||||
if isinstance(i,int):
|
if isinstance(i,int):
|
||||||
|
page_sound = pygame.mixer.Sound("page.wav")
|
||||||
|
page_sound.set_volume(0.7)
|
||||||
|
page_sound.play()
|
||||||
pages[visible_page].visible = False
|
pages[visible_page].visible = False
|
||||||
visible_page = i
|
visible_page = i
|
||||||
pages[visible_page].visible = True
|
pages[visible_page].visible = True
|
||||||
@@ -529,7 +561,7 @@ def main(data: dict):
|
|||||||
scaled_xy = (x/ratio_x,y/ratio_y)
|
scaled_xy = (x/ratio_x,y/ratio_y)
|
||||||
held_word.position = Vector2(scaled_xy) - Vector2(WORD_WIDTH//2,WORD_HEIGHT//2)
|
held_word.position = Vector2(scaled_xy) - Vector2(WORD_WIDTH//2,WORD_HEIGHT//2)
|
||||||
|
|
||||||
# RENDER YOUR GAME HERE
|
# render pages
|
||||||
for p in pages:
|
for p in pages:
|
||||||
if not p.visible:
|
if not p.visible:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user