changeset 531:5f1058593462

Remove all tails by default
author Stefano Rivera <stefano@rivera.za.net>
date Sun, 10 Apr 2011 00:18:36 +0200
parents f6bd04e5a414
children eec2cf912e03
files data/game.json skaapsteker/__init__.py skaapsteker/__main__.py skaapsteker/gamestate.py
diffstat 4 files changed, 17 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/data/game.json	Sun Apr 10 00:14:30 2011 +0200
+++ b/data/game.json	Sun Apr 10 00:18:36 2011 +0200
@@ -1,16 +1,7 @@
 {
     "fox": {
         "item": null,
-        "tails" : [
-            "shapeshift",
-            "fireball",
-            "sprint",
-            "invisibility",
-            "flight",
-            "shield",
-            "steal",
-            "lightning"
-        ],
+        "tails" : [],
         "shape": "fox",
         "cur_health" : 40,
         "max_health" : 40,
--- a/skaapsteker/__init__.py	Sun Apr 10 00:14:30 2011 +0200
+++ b/skaapsteker/__init__.py	Sun Apr 10 00:18:36 2011 +0200
@@ -1,5 +1,6 @@
 options = {
     'debug_rects': False,
+    'all_tails': False,
     'dvorak': False,
     'sound': True,
 }
--- a/skaapsteker/__main__.py	Sun Apr 10 00:14:30 2011 +0200
+++ b/skaapsteker/__main__.py	Sun Apr 10 00:18:36 2011 +0200
@@ -37,6 +37,8 @@
     if DEBUG:
         parser.add_option("--level", type="str", default=None,
             dest="level", help="Initial level")
+        parser.add_option("--all-tails", action="store_true", default=False,
+            dest='all_tails', help="Start with all the tails")
         parser.add_option("--no-rects", action="store_false", default=True,
             dest="rects", help="Disable debugging rects")
     opts, _ = parser.parse_args(args or [])
@@ -45,6 +47,7 @@
     options['save_location'] = opts.save_location
     if DEBUG:
         options['debug_rects'] = opts.rects
+        options['all_tails'] = opts.all_tails
         return opts.level
 
 
--- a/skaapsteker/gamestate.py	Sun Apr 10 00:14:30 2011 +0200
+++ b/skaapsteker/gamestate.py	Sun Apr 10 00:18:36 2011 +0200
@@ -2,6 +2,7 @@
 import json
 
 from . import data
+from . import options
 from .sprites.base import find_sprite
 
 
@@ -55,6 +56,17 @@
 
     def new_game(self):
         self.load_game(data.filepath("game.json"))
+        if options['all_tails']:
+            self.data['fox']['tails'] += [
+                "fireball",
+                "flight",
+                "invisibility",
+                "lightning",
+                "shapeshift",
+                "shield",
+                "sprint",
+                "steal",
+            ]
         self.save_game()
 
     def save_game(self):