Changeset 433:fe99a4e04b2b


Ignore:
Timestamp:
04/09/11 17:00:43 (12 years ago)
Author:
Simon Cross <hodgestar@…>
Branch:
default
Phase:
public
Message:

Make recharge time depend on the number of tails.

Location:
skaapsteker
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • skaapsteker/constants.py

    r411 r433  
    1818DOUBLE_TAP_TIME = 0.15
    1919
    20 RECHARGE_TIME = 1
    2120
    2221# Layer defination
  • skaapsteker/sprites/player.py

    r431 r433  
    77from ..sprites.projectiles import Fireball, Lightning
    88from ..physics import Sprite
    9 from ..constants import Layers, FoxHud, DOUBLE_TAP_TIME, RECHARGE_TIME
     9from ..constants import Layers, FoxHud, DOUBLE_TAP_TIME
    1010from ..data import get_files, load_image
    1111from ..engine import PlayerDied, AddSpriteEvent, OpenNotification
     
    3131        self._animation_frame = 0.0
    3232        self._last_time = time.time()
    33         self._last_attacked = {
     33        self._recharge_timers = {
    3434                'fireball': time.time(),
    3535                'lightning': time.time(),
     
    386386        if self.recharge_level(attack) < 1:
    387387            return False
    388         self._last_attacked[attack] = time.time()
     388        self._recharge_timers[attack] = time.time()
    389389        return True
    390390
    391391    def recharge_level(self, attack):
    392         return min((time.time() - self._last_attacked[attack]) / RECHARGE_TIME, 1)
     392        recharge_time = 2.0 / len(self._me.tails)
     393        return min((time.time() - self._recharge_timers[attack]) / recharge_time, 1)
    393394
    394395    def discharge_level(self, tail):
Note: See TracChangeset for help on using the changeset viewer.