diff options
author | Rodolfo D. Arce S <rodolfo.arce.s@gmail.com> | 2011-06-02 21:18:33 (GMT) |
---|---|---|
committer | Rodolfo D. Arce S <rodolfo.arce.s@gmail.com> | 2011-06-02 21:18:33 (GMT) |
commit | b83b3fcc8ff50fe4452c3e6c278b9925e5ec210a (patch) | |
tree | aadedadf5fe495652f249735271383980cbef165 /main.py | |
parent | ed1ccf7802938dbdbc4704a852b462e8b1cd8158 (diff) |
Planting logic is fully functional
Diffstat (limited to 'main.py')
-rw-r--r-- | main.py | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -17,13 +17,12 @@ window_h = 640 window_w = 480 # Background -bg_color = [204, 102, 0] +bg_color = [255, 255, 255] screen = pygame.display.set_mode( (window_h, window_w) ) pygame.display.set_caption("Ranger") # Tree plant_time = 100 -new_plant = False trees = [] start_time = time.time() @@ -62,16 +61,18 @@ while True: exit() if ranger.plant == True: - ranger.new_plant = True ranger.plant = False - new_plant_position = ranger.position + 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 > 200: trees.append(Tree( new_plant_position ) ) plant_time = 0 - new_plant = False + ranger.new_plant = False # Update ranger position based on events ranger.update() |