Commits

Anonymous committed 31c2bdc

Patches to the last minor release. Should fix the turbo leaking.

Comments (0)

Files changed (3)

FatxFast/modes/mode.py

 # Versioning based on: 
 # http://en.wikipedia.org/wiki/Versioning#Designating_development_stage
 __author__ = "dryatu (c) 2013"
-__version__ = "1.2.4"
+__version__ = "1.2.3"
 
 
 from FatxFast import camera
         self.scene.remove_players()
         self.scene.tilemap.unload_map()
         self.scene.playing = False
-    
+        
         self.scene.manager.clear()
         self.scene.manager.push_scene("introscene")
         self.scene.manager.push_scene("gameendscene", text=text,
     def key_pressed(self, key, utf, mod):
         if key == self.hotkeys["player1-map"]:
             self.open_map(self.player1)
-        elif key == self.hotkeys["player1-walk"]:
-            self.player1.run()
-
-    def key_released(self, key):
-        if key == self.hotkeys["player1-walk"]:
-            self.player1.stop_run()
 
     def keys_held(self):
         keys = super(GameMode, self).keys_held()
             player1.set_accel(x=Physics.accelspeed)
         else:
             player1.set_accel(x=0)
+        if keys[self.hotkeys["player1-walk"]]:
+            player1.turbo()
         return keys
 
     def level_up(self, player): 

FatxFast/modes/multimode.py

         elif keys[self.hotkeys["player2-right"]]:
             player2.set_accel(x=Physics.accelspeed)
         else:
-            player2.set_accel(x=0)     
+            player2.set_accel(x=0)  
+        if keys[self.hotkeys["player2-walk"]]:
+            self.player2.turbo()
     
     def key_pressed(self, key, utf, mod):
         super(MultiMode, self).key_pressed(key, utf, mod)
-        if key == self.hotkeys["player2-walk"]:
-            self.player2.run()
-        elif key == self.hotkeys["player2-map"]:
+        if key == self.hotkeys["player2-map"]:
             self.open_map(self.player2)
 
-    def key_released(self, key):
-        super(MultiMode, self).key_released(key)
-        if key == self.hotkeys["player2-walk"]:
-            self.player2.stop_run()
-
     def level_up(self, player):
         if self.scene.levelsystem.increase_level():
             super(MultiMode, self).level_up(player)

FatxFast/objects/player.py

         self.maps_left = 0
         self._turbo = 1
         self.items = {}
-        self._running = False
+        self._turboing = False
 
     def add_item(self, item):
         self.items[item.name] = item
 
     def _consume_turbo(self, amount):
-        if not self._running:
+        if not self._turboing:
             return False
         if self._turbo > 0:
             self._turbo -= amount
         if self._turbo <= 0:
-            self.stop_run()
             self._turbo = 0
+            self.stop_turbo()
 
     def get_item(self, itemname):
         return self.items[itemname]
         if itemname in self.items:
             del self.items[itemname]
 
-    def run(self):
-        self._running = True
+    def turbo(self):
+        self._turboing = True
         self.physics.maxspeed = self.physics.get_default_maxspeed()*1.5
 
     def set_turbo(self, amount):
             amount = 1
         self._turbo = amount
 
-    def stop_run(self):
-        self._running = False
+    def stop_turbo(self):
+        self._turboing = False
         self.physics.maxspeed = self.physics.get_default_maxspeed()
 
     def update(self, dt):
         self._consume_turbo(0.0005*dt)
         super(Player, self).update(dt)
+        self.stop_turbo()