-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAZquiz.py
More file actions
38 lines (30 loc) · 970 Bytes
/
Copy pathAZquiz.py
File metadata and controls
38 lines (30 loc) · 970 Bytes
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
import pygame
import math
# Inicializace Pygame
pygame.init()
# Nastavení okna
width, height = 800, 600
screen = pygame.display.set_mode((width, height))
# Barva hexagonu
hex_color = (100, 100, 100)
# Souřadnice hexagonu
hex_radius = 75
hex_center = (400, 300)
angle = 2 * math.pi / 6
hex_points = [(hex_center[0] + hex_radius * math.cos(i * angle), hex_center[1] + hex_radius * math.sin(i * angle)) for i in range(6)]
# Hlavní smyčka hry
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Detekce kliknutí na hexagon
if event.type == pygame.MOUSEBUTTONDOWN:
x, y = pygame.mouse.get_pos()
if math.dist((x, y), hex_center) <= hex_radius:
print("Hexagon byl stisknut!")
# Vykreslení hexagonu
screen.fill((0, 0, 0))
pygame.draw.polygon(screen, hex_color, hex_points)
pygame.display.flip()
pygame.quit()