Merge branch 'master' of ctpug.org.za:tabakrolletjie
authorSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 19:06:46 +0000 (21:06 +0200)
committerSimon Cross <hodgestar@gmail.com>
Sat, 10 Sep 2016 19:06:46 +0000 (21:06 +0200)
15 files changed:
data/images/32/day.png [new file with mode: 0644]
data/images/32/eyeballA.png
data/images/32/eyeballB.png
data/images/32/eyeballC.png
data/images/32/eyelid.png [new file with mode: 0644]
data/images/Makefile
data/stations/01-tutorial.json
sources/vector/day.svg [new file with mode: 0644]
sources/vector/eyeballA.svg
sources/vector/eyeballB.svg
sources/vector/eyeballC.svg
sources/vector/eyelid.svg [new file with mode: 0644]
tabakrolletjie/enemies.py
tabakrolletjie/scenes/help.py
tabakrolletjie/scenes/night.py

diff --git a/data/images/32/day.png b/data/images/32/day.png
new file mode 100644 (file)
index 0000000..7301d50
Binary files /dev/null and b/data/images/32/day.png differ
index c22acad562758e0672f2d917e78d66347db5ddc1..01cce3d02263acc8632c644507822cef67b8da58 100644 (file)
Binary files a/data/images/32/eyeballA.png and b/data/images/32/eyeballA.png differ
index d0702f011a45b0fba99cc5b8196c67fdf9e4f6bf..e5bdde61dfcd629df43dedf521362be6d73b7b0d 100644 (file)
Binary files a/data/images/32/eyeballB.png and b/data/images/32/eyeballB.png differ
index 7b8f594b446752519a549a32c15b2090c5885589..2825bd6c9a5ddb991f4fcadd2a8cb3a90775c4ad 100644 (file)
Binary files a/data/images/32/eyeballC.png and b/data/images/32/eyeballC.png differ
diff --git a/data/images/32/eyelid.png b/data/images/32/eyelid.png
new file mode 100644 (file)
index 0000000..3da9774
Binary files /dev/null and b/data/images/32/eyelid.png differ
index 17b0befb8e3f29f6cf4532097a505ce539246fdf..3b92dcb38e310dea268327ec26e35bc9a77ea977 100644 (file)
@@ -3,10 +3,10 @@ VPATH=../../sources/vector
 SEED=seed
 TURNIP=turnip1 turnip2 turnip3
 MOULD_BODY=mouldA mouldB mouldC
-MOULD=eyeballA eyeballB eyeballC
+MOULD=eyeballA eyeballB eyeballC eyelid
 LIGHT=spotlight lamp laser
 LIGHT_MASK=light_mask_2_1 light_mask_2_2 light_mask_3_1 light_mask_3_2 light_mask_3_3
-CONTROLS=night default_cursor exit pause play
+CONTROLS=night default_cursor exit pause play day
 
 IMG16=$(MOULD_BODY)
 IMG32=$(MOULD_BODY) $(MOULD) $(LIGHT) $(SEED) $(LIGHT_MASK) $(CONTROLS)
index 59b6935074e19c7045c0848391a8ad665fbde4dd..3c2ec596c7aa866face3cbcb8f1f9d51a305abb4 100644 (file)
@@ -6,9 +6,9 @@
     "turnip target": 10
   },
   "battery": {
-    "current": 200,
-    "max": 200,
-    "recharge": 100
+    "current": 4000,
+    "max": 4000,
+    "recharge": 4000
   },
   "available_lights": [
     {
diff --git a/sources/vector/day.svg b/sources/vector/day.svg
new file mode 100644 (file)
index 0000000..834615c
--- /dev/null
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="100mm"
+   height="100mm"
+   viewBox="0 0 354.33071 354.33071"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="day.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="215.64212"
+     inkscape:cy="168.74492"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="true"
+     inkscape:window-width="1264"
+     inkscape:window-height="720"
+     inkscape:window-x="102"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1"
+     inkscape:object-nodes="true"
+     inkscape:snap-smooth-nodes="true">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4423"
+       units="mm"
+       spacingx="3.543307"
+       spacingy="3.543307" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-698.0315)">
+    <path
+       sodipodi:type="star"
+       style="opacity:1;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
+       id="path7027"
+       sodipodi:sides="16"
+       sodipodi:cx="177.16534"
+       sodipodi:cy="875.19684"
+       sodipodi:r1="159.44884"
+       sodipodi:r2="101.03444"
+       sodipodi:arg1="1.5707963"
+       sodipodi:arg2="1.7671458"
+       inkscape:flatsided="false"
+       inkscape:rounded="0"
+       inkscape:randomized="0"
+       d="m 177.16535,1034.6457 -19.71084,-60.35577 -41.30759,48.21847 4.8867,-63.30449 -56.615627,28.74029 28.740289,-56.61563 -63.304453,4.8867 48.218426,-41.30758 -60.355748,-19.71085 60.355745,-19.71084 -48.218427,-41.30759 63.30445,4.88671 -28.740288,-56.61563 56.615623,28.74029 -4.8867,-63.30446 41.30759,48.21843 19.71084,-60.35575 19.71084,60.35575 41.30759,-48.21843 -4.8867,63.30445 56.61563,-28.74029 -28.74029,56.61563 63.30445,-4.8867 -48.21843,41.30758 60.35575,19.71084 -60.35574,19.71084 48.21842,41.30759 -63.30445,-4.8867 28.74029,56.61563 -56.61562,-28.74029 4.8867,63.3045 -41.30759,-48.21847 z" />
+  </g>
+</svg>
index aa5430951291129714d4fc514110286e53b5e8b2..45fa09eed51636430ab5edce02ec5c163594ef85 100644 (file)
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="1.4"
-     inkscape:cx="132.16977"
+     inkscape:cx="6.4554843"
      inkscape:cy="182.29837"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="1366"
+     inkscape:window-width="1264"
      inkscape:window-height="720"
-     inkscape:window-x="1920"
+     inkscape:window-x="102"
      inkscape:window-y="0"
      inkscape:window-maximized="1">
     <inkscape:grid
        cx="201.42857"
        cy="905.21936"
        r="32.142857" />
-    <path
-       style="opacity:0.75;fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       d="m 76.041663,911.4434 c 11.221167,32.05511 2.754672,80.09704 78.571437,93.5714 81.62653,14.5069 90.08129,-60.45024 114.99999,-74.99997 -79.51117,45.47401 -119.17457,40.32588 -193.571427,-18.57143 z"
-       id="path5339"
-       inkscape:connector-curvature="0"
-       sodipodi:nodetypes="cscc" />
   </g>
 </svg>
index 0886654e551c021bad795064a79dc5850c38c221..0262fd0b4810ba95148da3b2cf3df286f837bd18 100644 (file)
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="1.4"
-     inkscape:cx="8.9698557"
+     inkscape:cx="-116.74443"
      inkscape:cy="182.29837"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="1366"
+     inkscape:window-width="1264"
      inkscape:window-height="720"
-     inkscape:window-x="1920"
+     inkscape:window-x="102"
      inkscape:window-y="0"
      inkscape:window-maximized="1">
     <inkscape:grid
        cx="154.28572"
        cy="872.36218"
        r="32.142857" />
-    <path
-       style="opacity:0.75;fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       d="m 76.041664,911.44337 c 11.22117,32.05511 2.75467,80.09704 78.571436,93.57143 81.62653,14.5069 90.08129,-60.45027 114.99999,-75 -79.51117,45.47401 -119.17457,40.32588 -193.571426,-18.57143 z"
-       id="path5339"
-       inkscape:connector-curvature="0"
-       sodipodi:nodetypes="cscc" />
   </g>
 </svg>
index c864b43be1b6f8fd242b924b611e0d78d3349f40..b400b57a0e18c189a84f10ab209c51c2dc6f1227 100644 (file)
      inkscape:pageopacity="0.0"
      inkscape:pageshadow="2"
      inkscape:zoom="1.4"
-     inkscape:cx="123.25557"
+     inkscape:cx="-2.4587157"
      inkscape:cy="182.29837"
      inkscape:document-units="px"
      inkscape:current-layer="layer1"
      showgrid="false"
-     inkscape:window-width="1366"
+     inkscape:window-width="1264"
      inkscape:window-height="720"
-     inkscape:window-x="1920"
+     inkscape:window-x="102"
      inkscape:window-y="0"
      inkscape:window-maximized="1">
     <inkscape:grid
        cx="226.78571"
        cy="835.21936"
        r="28.214285" />
-    <path
-       style="opacity:0.75;fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
-       d="m 76.041664,911.44337 c 11.22117,32.05511 2.75467,80.09704 78.571436,93.57143 81.62653,14.5069 90.08129,-60.45027 114.99999,-75 -79.51117,45.47401 -119.17457,40.32588 -193.571426,-18.57143 z"
-       id="path5339"
-       inkscape:connector-curvature="0"
-       sodipodi:nodetypes="cscc" />
   </g>
 </svg>
diff --git a/sources/vector/eyelid.svg b/sources/vector/eyelid.svg
new file mode 100644 (file)
index 0000000..b37277f
--- /dev/null
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+   width="100mm"
+   height="100mm"
+   viewBox="0 0 354.33071 354.33071"
+   id="svg2"
+   version="1.1"
+   inkscape:version="0.91 r13725"
+   sodipodi:docname="eyelid.svg">
+  <defs
+     id="defs4" />
+  <sodipodi:namedview
+     id="base"
+     pagecolor="#ffffff"
+     bordercolor="#666666"
+     borderopacity="1.0"
+     inkscape:pageopacity="0.0"
+     inkscape:pageshadow="2"
+     inkscape:zoom="1.4"
+     inkscape:cx="227.95469"
+     inkscape:cy="162.55601"
+     inkscape:document-units="px"
+     inkscape:current-layer="layer1"
+     showgrid="false"
+     inkscape:window-width="1264"
+     inkscape:window-height="720"
+     inkscape:window-x="102"
+     inkscape:window-y="0"
+     inkscape:window-maximized="1">
+    <inkscape:grid
+       type="xygrid"
+       id="grid4423"
+       units="mm"
+       spacingx="3.543307"
+       spacingy="3.543307" />
+  </sodipodi:namedview>
+  <metadata
+     id="metadata7">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <g
+     inkscape:label="Layer 1"
+     inkscape:groupmode="layer"
+     id="layer1"
+     transform="translate(0,-698.0315)">
+    <path
+       style="opacity:0.75;fill:#ffffff;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+       d="m 76.041663,911.4434 c 11.221167,32.05511 2.754672,80.09704 78.571437,93.5714 81.62653,14.5069 90.08129,-60.45024 114.99999,-74.99997 -79.51117,45.47401 -119.17457,40.32588 -193.571427,-18.57143 z"
+       id="path5339"
+       inkscape:connector-curvature="0"
+       sodipodi:nodetypes="cscc" />
+  </g>
+</svg>
index 4fc9470ba90155cf109f20a7292496b148982039..146ef56fa973e9823e0e09bc111947bf6d723183 100644 (file)
@@ -12,7 +12,7 @@ from .constants import (SCREEN_SIZE, MOULD_CATEGORY, OBSTACLE_CATEGORY,
                         TURNIP_CATEGORY, COLOURS)
 from .loader import loader
 from .sound import sound
-from .transforms import Multiply
+from .transforms import Multiply, Overlay
 from .utils import debug_timer
 
 MOULD_FILTER = pymunk.ShapeFilter(
@@ -101,7 +101,10 @@ class Mould(pymunk.Body):
         if not self._eyeball:
             name = random.choice(
                 ('eyeballA.png', 'eyeballB.png', 'eyeballC.png'))
-            self._eyeball = loader.load_image("32", name)
+            self._eyeball = loader.load_image("32", name,
+                transform=Overlay(colour=self._transform.colour+(127,)))
+            eyelid = loader.load_image("32", "eyelid.png", transform=self._transform)
+            self._eyeball.blit(eyelid, (0, 0), None)
         return self._eyeball
 
     def set_health(self, new_health):
@@ -146,8 +149,6 @@ class Mould(pymunk.Body):
                 child._health = self._health
                 moulds.append(child)
                 refresh = True
-                if random.randint(0, 10) < 2:
-                    sound.play_sound("mouth_pop_2a.ogg")
 
         if self._age in MOULD_STAGES:
             # We grow in size
@@ -157,6 +158,7 @@ class Mould(pymunk.Body):
         if self._age > MOULD_STAGES[1] and random.randint(0, 500) < 1:
             # Maybe we grow an eyeball
             self.has_eyeball = True
+            sound.play_sound("mouth_pop_2a.ogg")
 
         if self._age > MAX_AGE:
             # We die of old age
index 0f6a94c87b8f1d3f86328598a987177e9a5a5bac..c58fea548eb8cc1dbcf77f6d17770ca6c12c140d 100644 (file)
@@ -90,6 +90,11 @@ class HelpScene(BaseScene):
             HelpItem(("32", "pause.png"), (
                 "You can pause the game during the night if you need to make a"
                 " more detailed analysis of why you're losing horribly.")),
+            HelpItem(("32", "day.png"), (
+                "If you have run out of turnips, you can click this button to"
+                " skip to the next day. Or you can keep playing with your lights."
+                " If you have no power left either, or you are completely"
+                " bankrupt, the night will end automatically.")),
         ]
 
         # Special mould assembly
@@ -99,6 +104,9 @@ class HelpScene(BaseScene):
         items[1]._img.blit(
             loader.load_image("32", "eyeballA.png").convert_alpha(),
             (10, 10), None)
+        items[1]._img.blit(
+            loader.load_image("32", "eyelid.png").convert_alpha(),
+            (10, 10), None)
 
         return items
 
index e78ba815c3294219efb0a4a421e0850969a725c9..e4cc73384b9c433f61755cfd16fe73a35226770f 100644 (file)
@@ -58,6 +58,11 @@ class NightScene(BaseScene):
             '32', 'exit.png', name='exit', pos=(SCREEN_SIZE[0] - 50, y)))
         return tools
 
+    def add_day_button(self):
+        y = SCREEN_SIZE[1] - 40
+        self._tools.append(ImageButton(
+            '32', 'day.png', name='day', pos=(SCREEN_SIZE[0] - 200, y)))
+
     @property
     def turnip_count(self):
         return len(self._turnips)
@@ -124,6 +129,8 @@ class NightScene(BaseScene):
                         elif tool.name == 'exit':
                             from .menu import MenuScene
                             SceneChangeEvent.post(scene=MenuScene())
+                        elif tool.name == 'day':
+                            self._to_day()
 
     def toggle_pause(self):
         self._paused = not self._paused
@@ -175,6 +182,10 @@ class NightScene(BaseScene):
                 self._end_night()
             if not self._mould.alive():
                 self._end_night()
+            if not self.turnip_count:
+                self.add_day_button()
+            if not self.turnip_count and not self._battery.current:
+                self._end_night()
 
     def exit(self, gamestate):
         turnip_data = [turnip.serialize() for turnip in self._turnips]