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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
import pygame
from random import randint
class Tree:
def __init__(self, surface, position, tree_size):
self.position = position
self.height = 10
self.width = 10
self.circle_w = randint (6,8)
self.size = tree_size
self.circle1 = self.size * randint (1,2)
self.circle2 = self.size * randint (1,2)
self.surface = surface
self.color_circle = (randint(0,3), randint(100,200), randint(0,3))
self.color_rect = (5, randint(100,200), 5)
def draw(self):
pygame.draw.rect( self.surface, self.color_rect, \
( (self.position[0] - self.height/2), \
(self.position[1] - self.width/2), \
self.size, \
self.size), \
0)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] + self.height/2), \
(self.position[1] + self.width/2)), \
self.circle1, \
self.circle_w)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0]), \
(self.position[1] + self.width/2)), \
self.circle2, \
self.circle_w)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] + self.height/2), \
(self.position[1])), \
self.circle1, \
self.circle_w)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] - self.height/2), \
(self.position[1] - self.width/2)), \
self.circle2, \
self.circle_w)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0]), \
(self.position[1] - self.width/2)), \
self.circle1, \
self.circle_w)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] - self.height/2), \
(self.position[1])), \
self.circle2, \
self.circle_w)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] + self.height/2), \
(self.position[1]) - self.width/2), \
self.circle1, \
self.circle_w)
pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] - self.height/2), \
(self.position[1]) + self.width/2), \
self.circle2, \
self.circle_w)
|