Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodolfo D. Arce S <rodolfo.arce.s@gmail.com>2011-05-18 23:16:21 (GMT)
committer Rodolfo D. Arce S <rodolfo.arce.s@gmail.com>2011-05-18 23:16:21 (GMT)
commitd6ab7ab099c66554a80b06a5ad12ca656f0b69b1 (patch)
tree324de4b9c64ee5034fdc154fd76bb6e95d529192
parentb2afd587b570c9588047fda93e4526bae100faaf (diff)
Organized better update and display
-rw-r--r--main.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/main.py b/main.py
index f6e1dac..fae042d 100644
--- a/main.py
+++ b/main.py
@@ -15,8 +15,8 @@ pygame.display.set_caption("Ranger")
tree_color = [51, 204, 0]
tree_height = tree_width = 40
tree_radius = 15
-
-#clock = pygame.time.Clock()
+trees = []
+clock = pygame.time.Clock()
# Draw background
@@ -24,11 +24,11 @@ screen.fill(bg_color)
# Draw everything on top of that
number_trees = 160
while number_trees != 0:
- Tree(screen, \
+ trees.append(Tree(screen, \
(randint(0,5), randint(0,255), randint(0,5) ), \
window_h, \
window_w, \
- (randint(0,window_h), randint(0,window_w)) , 15, 20, 20)
+ (randint(0,window_h), randint(0,window_w)) , 15, 20, 20) )
number_trees -=1
@@ -43,6 +43,9 @@ while True:
keyboard = pygame.key.get_pressed()
if keyboard[K_ESCAPE]:
exit()
+
+ for arbol in trees:
+ trees.remove(arbol)
pygame.display.update()
- #clock.tick(60)
+ clock.tick(60)