Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/main.py
diff options
context:
space:
mode:
Diffstat (limited to 'main.py')
-rw-r--r--main.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/main.py b/main.py
index 79c8ad8..8edc158 100644
--- a/main.py
+++ b/main.py
@@ -27,7 +27,7 @@ window_h, window_w = screen.get_size ()
# Tree
-plant_time = 100
+plant_time = 10
trees = []
start_time = time.time()
@@ -55,6 +55,10 @@ while number_trees != 0:
trees.append(Tree((randint(0,window_h), randint(0,window_w))) )
number_trees -= 1
+for arbol in trees:
+ arbol.sprout_time = 200
+
+
score = 0
while True:
@@ -78,12 +82,14 @@ while True:
if ranger.new_plant == False:
new_plant_position = ranger.position
ranger.new_plant = True
-
+
+
if ranger.new_plant == True:
plant_time += 1
- if plant_time > 300:
- trees.append(Tree( new_plant_position ) )
+ #trees.append(Tree( new_plant_position ) )
+ if plant_time > 50:
+ trees.append(Tree( new_plant_position ) )
plant_time = 0
ranger.new_plant = False
@@ -106,12 +112,20 @@ while True:
if ranger.collides_with(cortador):
cutter.remove(cortador)
+ # Draw trees or grow them
+ for arbol in trees:
+ if arbol.sprout_time < 200:
+ arbol.sprout_time += 1
+ arbol.draw(screen)
+
# Tree cutters kills trees
for arbol in trees:
for cortador in cutter:
if cortador.collides_with(arbol):
cortador.cut_tree = True
+ arbol.draw_alert(screen)
cortador.cut_time += 1
+ arbol.cutting_time -=1
if cortador.cut_tree == True and cortador.cut_time == 100:
trees.remove(arbol)
cortador.cut_time = 0
@@ -122,15 +136,14 @@ while True:
cutter_time = 0
cutter_time += 1
- for arbol in trees:
- arbol.draw(screen)
+
## SCORE IS DRAWN AFTER EVERYTHING ELSE
# Score is equal to amount of trees
for arbol in trees:
score += 1
# Score text
- score_text = "Air: " + str(score) + " Planting in : " + str(plant_time)
+ score_text = "Air: " + str(score)
font = pygame.font.Font(None, 36)
text = font.render( score_text , 1, (0, 0, 0, 0))
screen.blit(text, (0, 0))