forked from 24_DemkinDE/lab3prog
Обновить hare.py
This commit is contained in:
25
hare.py
25
hare.py
@@ -25,25 +25,12 @@ def draw_leg(surface, x, y, width, height, color):
|
||||
ellipse(surface, color, (x - width // 2, y - height // 2, width, height))
|
||||
|
||||
def draw_hare(surface, x, y, width, height, color):
|
||||
''' Рисует зайца '''
|
||||
body_width = width // 2
|
||||
body_height = height // 2
|
||||
body_y = y + body_height // 2
|
||||
draw_body(surface, x, body_y, body_width, body_height, color)
|
||||
|
||||
head_size = height // 4
|
||||
head_y = y - head_size // 2
|
||||
draw_head(surface, x, head_y, head_size, color)
|
||||
|
||||
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
|
||||
leg_y = y + height // 2 - leg_height // 2
|
||||
for leg_x in (x - width // 4, x + width // 4):
|
||||
draw_leg(surface, leg_x, leg_y, width // 4, leg_height, color)
|
||||
draw_body(surface, x, y + height // 4, width // 2, height // 2, color)
|
||||
draw_ear(surface, x - height // 16, y - height // 2 + height // 6, width // 8, height // 3, color)
|
||||
draw_ear(surface, x + height // 16, y - height // 2 + height // 6, width // 8, height // 3, color)
|
||||
draw_head(surface, x, y - height // 8, height // 4, color)
|
||||
draw_leg(surface, x - width // 4, y + height // 2 - height // 32, width // 4, height // 16, color)
|
||||
draw_leg(surface, x + width // 4, y + height // 2 - height // 32, width // 4, height // 16, color)
|
||||
|
||||
# Рисуем зайца
|
||||
draw_hare(screen, 200, 200, 200, 300, GRAY)
|
||||
|
||||
Reference in New Issue
Block a user