-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (44 loc) · 1.24 KB
/
main.py
File metadata and controls
55 lines (44 loc) · 1.24 KB
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
## Import kódu knihovny
from p5 import *
from random import randint
# Zde je funkce mouse_pressed
def mouse_pressed():
# print('🎯')
if hit_colour == Color("blue").hex:
print("Trefil jsi vnější kruh, 50 bodů!")
elif hit_colour == Color("red").hex:
print("Trefil jsi vnitřní kruh, 200 bodů!")
elif hit_colour == Color("yellow").hex:
print("Trefil jsi střed, 500 bodů!")
else:
print("Vedle! Žádné body!")
# Zde je funkce shoot_arrow
def shoot_arrow():
global hit_colour
arrow_x = randint(100, 300)
arrow_y = randint(100, 300)
hit_colour = get(arrow_x, arrow_y).hex
# print(hit_colour)
fill("brown")
circle(arrow_x, arrow_y, 15)
def setup():
# Zde si nastav svou hru
size(400, 400)
no_stroke()
def draw():
# Co dělat v každém snímku
fill("cyan")
rect(0, 0, 400, 250)
fill("lightgreen")
rect(0, 250, 400, 150)
fill("brown")
triangle(150, 350, 200, 150, 250, 350)
fill("blue")
circle(200, 200, 170)
fill("red")
circle(200, 200, 110) # Nakresli vnitřní kruh
fill("yellow")
circle(200, 200, 30) # Nakresli prostřední kruh
shoot_arrow()
# Toto si ponech pro spuštění kódu
run(frame_rate=2)