Обновить hare.py
This commit is contained in:
47
hare.py
47
hare.py
@@ -24,40 +24,25 @@ def draw_ear(surface, x, y, width, height, color):
|
|||||||
def draw_leg(surface, x, y, width, height, color):
|
def draw_leg(surface, x, y, width, height, color):
|
||||||
ellipse(surface, color, (x - width // 2, y - height // 2, width, height))
|
ellipse(surface, color, (x - width // 2, y - height // 2, width, height))
|
||||||
|
|
||||||
# ЭТА ФУНКЦИЯ СДЕЛАНА ПЛОХО
|
|
||||||
def draw_hare(surface, x, y, width, height, color):
|
def draw_hare(surface, x, y, width, height, color):
|
||||||
# Тело
|
body_width = width // 2
|
||||||
w1 = width // 2
|
body_height = height // 2
|
||||||
h1 = height // 2
|
body_y = y + body_height // 2
|
||||||
y1 = y + h1 // 2
|
draw_body(surface, x, body_y, body_width, body_height, color)
|
||||||
ellipse(surface, color, (x - w1 // 2, y1 - h1 // 2, w1, h1))
|
|
||||||
|
|
||||||
# Голова
|
head_size = height // 4
|
||||||
s2 = height // 4
|
head_y = y - head_size // 2
|
||||||
y2 = y - s2 // 2
|
draw_head(surface, x, head_y, head_size, color)
|
||||||
circle(surface, color, (x, y2), s2 // 2)
|
|
||||||
|
ear_height = height // 3
|
||||||
|
ear_y = y - height // 2 + ear_height // 2
|
||||||
|
for ear_x in (x - head_size // 4, x + head_size // 4):
|
||||||
|
draw_ear(surface, ear_x, ear_y, width // 8, ear_height, color)
|
||||||
|
|
||||||
# левое ухо
|
leg_height = height // 16
|
||||||
eh = height // 3
|
leg_y = y + height // 2 - leg_height // 2
|
||||||
ey = y - height // 2 + eh // 2
|
for leg_x in (x - width // 4, x + width // 4):
|
||||||
ew = width // 8
|
draw_leg(surface, leg_x, leg_y, width // 4, leg_height, color)
|
||||||
ellipse(surface, color, (x - s2 // 4 - ew // 2, ey - eh // 2, ew, eh))
|
|
||||||
# правое ухо
|
|
||||||
ellipse(surface, color, (x + s2 // 4 - ew // 2, ey - eh // 2, ew, eh))
|
|
||||||
|
|
||||||
# Ноги - СТРАННЫЕ ПЕРЕМЕННЫЕ
|
|
||||||
lh = height // 16
|
|
||||||
ly = y + height // 2 - lh // 2
|
|
||||||
lw = width // 4
|
|
||||||
# левая нога
|
|
||||||
ellipse(surface, color, (x - width // 4 - lw // 2, ly - lh // 2, lw, lh))
|
|
||||||
# правая нога
|
|
||||||
ellipse(surface, color, (x + width // 4 - lw // 2, ly - lh // 2, lw, lh))
|
|
||||||
|
|
||||||
# НИ НА ЧТО НЕ ВЛИЯЮЩИЙ КОД
|
|
||||||
temp = 0
|
|
||||||
for i in range(5):
|
|
||||||
temp += i
|
|
||||||
|
|
||||||
# Рисуем зайца
|
# Рисуем зайца
|
||||||
draw_hare(screen, 200, 200, 200, 300, GRAY)
|
draw_hare(screen, 200, 200, 200, 300, GRAY)
|
||||||
|
|||||||
Reference in New Issue
Block a user