Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tree.py
diff options
context:
space:
mode:
Diffstat (limited to 'tree.py')
-rw-r--r--tree.py64
1 files changed, 35 insertions, 29 deletions
diff --git a/tree.py b/tree.py
index d6f2940..dbfd6cf 100644
--- a/tree.py
+++ b/tree.py
@@ -2,64 +2,70 @@ import pygame
from random import randint
class Tree:
- def __init__(self, surface, tree_color, window_h, window_w, position, tree_size, height, width):
+ def __init__(self, surface, position, tree_size):
self.position = position
- self.height = height
- self.width = width
+ 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 = tree_color
- pygame.draw.rect( self.surface, self.color, \
+ 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, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] + self.height/2), \
(self.position[1] + self.width/2)), \
- self.size*randint(1,2), \
- 8)
+ self.circle1, \
+ self.circle_w)
- pygame.draw.circle(self.surface, self.color, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0]), \
(self.position[1] + self.width/2)), \
- tree_size*randint(1,2), \
- 1)
+ self.circle2, \
+ self.circle_w)
- pygame.draw.circle(self.surface, self.color, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] + self.height/2), \
(self.position[1])), \
- tree_size*randint(1,2), \
- 8)
+ self.circle1, \
+ self.circle_w)
- pygame.draw.circle(self.surface, self.color, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] - self.height/2), \
(self.position[1] - self.width/2)), \
- tree_size*randint(1,2), \
- 8)
+ self.circle2, \
+ self.circle_w)
- pygame.draw.circle(self.surface, self.color, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0]), \
(self.position[1] - self.width/2)), \
- tree_size*randint(1,2), \
- 8)
+ self.circle1, \
+ self.circle_w)
- pygame.draw.circle(self.surface, self.color, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] - self.height/2), \
(self.position[1])), \
- tree_size*randint(1,2), \
- 8)
+ self.circle2, \
+ self.circle_w)
- pygame.draw.circle(self.surface, self.color, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] + self.height/2), \
(self.position[1]) - self.width/2), \
- tree_size*randint(1,2), \
- 8)
+ self.circle1, \
+ self.circle_w)
- pygame.draw.circle(self.surface, self.color, \
+ pygame.draw.circle(self.surface, self.color_circle, \
((self.position[0] - self.height/2), \
(self.position[1]) + self.width/2), \
- tree_size*randint(1,2), \
- 8)
+ self.circle2, \
+ self.circle_w)