Merge branch 'master' of ctpug.org.za:tabakrolletjie
authorSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 12:55:33 +0000 (14:55 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 12:55:33 +0000 (14:55 +0200)
TODO.txt
tabakrolletjie/enemies.py
tabakrolletjie/gamestate.py
tabakrolletjie/rays.py
tabakrolletjie/scenes/day.py
tabakrolletjie/scenes/night.py

index d859100113201563ce7a3d627022b6bdfc242e60..13d1539b82a62aaee08a42e61aa1c24894891725 100644 (file)
--- a/TODO.txt
+++ b/TODO.txt
@@ -5,12 +5,14 @@ TODO
 * Win condition
 * Battery and light power consts
 * Mould resistances
-* Mould power increases to prevent farming
+* Mould power increases to prevent farming (partially implemented, needs balancing)
 * Save game
 * More sounds
 * Five levels
 * Sunrise transition screen
 * 'End the Day' button
+* Seralize light on / off and colour selection state across day / night transition
+* 'Dawn breaks' transition screen
 
 Done
 ====
index 80a0776ee4736ac63ab55c13144c7c00df226c54..02491aa5138fabd40c12e89dda350e98822e45ef 100644 (file)
@@ -26,6 +26,11 @@ MAX_AGE = 60
 MAX_ELEMENTS = 400
 MAX_HEALTH = 100
 
+# Increase in health per day
+DAY_HEALTH = 10
+
+HEAL_FACTOR = 1
+
 MOULD_STAGES = [15, 25]
 
 
@@ -67,6 +72,9 @@ class Mould(pymunk.Body):
             self._eyeball = loader.load_image("32", name)
         return self._eyeball
 
+    def set_health(self, new_health):
+        self._health = new_health
+
     def tick(self, gamestate, space, moulds):
         """Grow and / or Die"""
 
@@ -74,7 +82,7 @@ class Mould(pymunk.Body):
 
         # we regain a health every tick, so we heal in the dark
         if self._health < MAX_HEALTH:
-            self._health += 1
+            self._health += HEAL_FACTOR
 
         refresh = False
 
@@ -150,6 +158,7 @@ class Boyd(object):
         self._moulds = []
         for position in gamestate.get_spawn_positions():
             seed = Mould(gamestate, space, position)
+            seed.set_health(MAX_HEALTH + gamestate.days * DAY_HEALTH)
             self._moulds.append(seed)
         self._image = pygame.surface.Surface(SCREEN_SIZE)
         self._image = self._image.convert_alpha(pygame.display.get_surface())
index 714a0475b7b5507a170f8176276827feaa08bad7..4ce92e832007db534b6af5422b7be2cc4d799d9d 100644 (file)
@@ -9,6 +9,7 @@ class GameState(object):
         }
         self.harvested = 0
         self.eaten = 0
+        self.days = 0
 
     @property
     def station(self):
index 11bfd33fd259e42fc397bbe0e63b3862860150e1..8a79c34c57b4c3ff89a7d31681c1c5ec0915f385 100644 (file)
@@ -130,7 +130,7 @@ class RayPolyManager(object):
         self._min_radius = value or 0.0
 
     def reaches(self, position):
-        distance = self.position.get_distance(self.position)
+        distance = self.position.get_distance(position)
         return (self._min_radius <= distance <= self._max_radius)
 
     def _set_radius_limits(self, radius_limits):
index b6abaac7db8227e448f1b65109efcdcee9c846c2..cb65569e3da70207fbeb33794e87c75a2a33d77a 100644 (file)
@@ -231,8 +231,8 @@ class DayScene(BaseScene):
             self._lights.tick()
 
     def _update_toolbar(self, gamestate):
-        text = ("Turnip Stocks: Seeds: %d. Planted: %d. "
+        text = ("Day: %d: Turnip Stocks: Seeds: %d. Planted: %d. "
                 "Harvested: %d. Destroyed: %d" %
-                (self._seeds, len(self._turnips),
+                (gamestate.days, self._seeds, len(self._turnips),
                  self._harvested, gamestate.eaten))
         self._toolbar = self._toolbar_font.render(text, True, (255, 255, 255))
index 6b42f6bf878dafad72ef01fc63077230c71cc8b4..aadff681400cd67a38794eba040dbe71a800d977 100644 (file)
@@ -82,3 +82,4 @@ class NightScene(BaseScene):
     def exit(self, gamestate):
         turnip_data = [turnip.serialize() for turnip in self._turnips]
         gamestate.turnips = turnip_data
+        gamestate.days += 1