From: Simon Cross Date: Sat, 10 Sep 2016 19:06:46 +0000 (+0200) Subject: Merge branch 'master' of ctpug.org.za:tabakrolletjie X-Git-Tag: tabakrolletjie-v1.0.0~53 X-Git-Url: https://git.ctpug.org.za/?p=tabakrolletjie.git;a=commitdiff_plain;h=48c809306d2aaf6ed2487aad4970138601d74a60;hp=0f420d66fa52bfdbd95683e44819c79c94211d7c Merge branch 'master' of ctpug.org.za:tabakrolletjie --- diff --git a/data/images/32/day.png b/data/images/32/day.png new file mode 100644 index 0000000..7301d50 Binary files /dev/null and b/data/images/32/day.png differ diff --git a/data/images/32/eyeballA.png b/data/images/32/eyeballA.png index c22acad..01cce3d 100644 Binary files a/data/images/32/eyeballA.png and b/data/images/32/eyeballA.png differ diff --git a/data/images/32/eyeballB.png b/data/images/32/eyeballB.png index d0702f0..e5bdde6 100644 Binary files a/data/images/32/eyeballB.png and b/data/images/32/eyeballB.png differ diff --git a/data/images/32/eyeballC.png b/data/images/32/eyeballC.png index 7b8f594..2825bd6 100644 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 index 0000000..3da9774 Binary files /dev/null and b/data/images/32/eyelid.png differ diff --git a/data/images/Makefile b/data/images/Makefile index 17b0bef..3b92dcb 100644 --- a/data/images/Makefile +++ b/data/images/Makefile @@ -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) diff --git a/data/stations/01-tutorial.json b/data/stations/01-tutorial.json index 59b6935..3c2ec59 100644 --- a/data/stations/01-tutorial.json +++ b/data/stations/01-tutorial.json @@ -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 index 0000000..834615c --- /dev/null +++ b/sources/vector/day.svg @@ -0,0 +1,81 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/sources/vector/eyeballA.svg b/sources/vector/eyeballA.svg index aa54309..45fa09e 100644 --- a/sources/vector/eyeballA.svg +++ b/sources/vector/eyeballA.svg @@ -26,14 +26,14 @@ 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"> - diff --git a/sources/vector/eyeballB.svg b/sources/vector/eyeballB.svg index 0886654..0262fd0 100644 --- a/sources/vector/eyeballB.svg +++ b/sources/vector/eyeballB.svg @@ -26,14 +26,14 @@ 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"> - diff --git a/sources/vector/eyeballC.svg b/sources/vector/eyeballC.svg index c864b43..b400b57 100644 --- a/sources/vector/eyeballC.svg +++ b/sources/vector/eyeballC.svg @@ -26,14 +26,14 @@ 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"> - diff --git a/sources/vector/eyelid.svg b/sources/vector/eyelid.svg new file mode 100644 index 0000000..b37277f --- /dev/null +++ b/sources/vector/eyelid.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/tabakrolletjie/enemies.py b/tabakrolletjie/enemies.py index 4fc9470..146ef56 100644 --- a/tabakrolletjie/enemies.py +++ b/tabakrolletjie/enemies.py @@ -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 diff --git a/tabakrolletjie/scenes/help.py b/tabakrolletjie/scenes/help.py index 0f6a94c..c58fea5 100644 --- a/tabakrolletjie/scenes/help.py +++ b/tabakrolletjie/scenes/help.py @@ -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 diff --git a/tabakrolletjie/scenes/night.py b/tabakrolletjie/scenes/night.py index e78ba81..e4cc733 100644 --- a/tabakrolletjie/scenes/night.py +++ b/tabakrolletjie/scenes/night.py @@ -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]