Add Boyd's spawn position to stations
authorNeil <neil@dip.sun.ac.za>
Sat, 10 Sep 2016 11:27:00 +0000 (13:27 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 10 Sep 2016 11:34:24 +0000 (13:34 +0200)
data/stations/station-alpha.json
data/stations/station-beta.json
tabakrolletjie/enemies.py
tabakrolletjie/gamestate.py

index f0e27e509bcd2af4aba2b09cd775887047d6862b..07f23e98b7cf1b134c6c6148341be9efb5a2fa97 100644 (file)
@@ -2,6 +2,7 @@
   "config": {
     "name": "Station Alpha",
     "power": 100,
+    "spawn positions": [[275, 300]],
     "seeds": 10
   },
   "obstacles": [
index ae16cff5d3eb359e372783af932de1dd17e3a97b..8273a5c3b9c66954db1d3326cc28f4f0f2172c69 100644 (file)
@@ -2,6 +2,7 @@
   "config": {
     "name": "Station Beta",
     "power": 100,
+    "spawn positions": [[25, 400], [1000, 410]],
     "seeds": 100
   },
   "obstacles": [
index eef2596e5300455ea7437d29642b27b9bdaabe02..422b1032b8b9f73b8ceccf4eeaee48df4a6673fb 100644 (file)
@@ -138,8 +138,10 @@ class Mould(pymunk.Body):
 class Boyd(object):
 
     def __init__(self, gamestate, space):
-        seed = Mould(gamestate, space, (275, 300))
-        self._moulds = [seed]
+        self._moulds = []
+        for position in gamestate.get_spawn_positions():
+            seed = Mould(gamestate, space, position)
+            self._moulds.append(seed)
         self._image = pygame.surface.Surface(SCREEN_SIZE)
         self._image = self._image.convert_alpha(pygame.display.get_surface())
         self._draw_moulds()
index 091b7093d419ac3024c4c52c35c6e984444fe47f..c678befb968eb83d6520531698ee78a82c4fabcb 100644 (file)
@@ -40,3 +40,6 @@ class GameState(object):
 
     def load_station(self, station):
         self._state["station"] = loader.load_station(station)
+
+    def get_spawn_positions(self):
+        return self._state["station"]["config"]["spawn positions"]