# # PowerUp.py # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; version 2 of the License. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # Copyright # Author: Salvatore S. Gionfriddo # Contributors: Nicholas F. Hoover # Created: 2007.07.04 # Last Modified: 2007.11.07 # import Settings from GameObject import GameObject from Animation import Animation from Effect import DrugEffect, PizzaEffect, TacosEffect, HungerBoost, HealthBoost, HeartBurn class PowerUp(GameObject): ############# # MOVEMENTS # ############# MOVEMENTS = [ (0,0), (0,0) ] #SITTIN ######## # MISC # ######## RECT_SIZE = (40, 40) TICKS_TO_LIVE = 30*60 #last for 1 minute? def __init__(self, facing, powerUpType = 0): GameObject.__init__(self) self.currentAnimation = powerUpType + facing self.facing = facing self.effects = [] self.ticksLeft = PowerUp.TICKS_TO_LIVE if powerUpType == PowerUp.DRUGS: effect = DrugEffect() elif powerUpType == PowerUp.PIZZA: effect = PizzaEffect() elif powerUpType == PowerUp.INDIAN: effect = HungerBoost() self.effects.append(HeartBurn()) elif powerUpType == PowerUp.TACOS: effect = HungerBoost() self.effects.append(TacosEffect()) elif powerUpType == PowerUp.CANDY: effect = HungerBoost(15) self.effects.append(HealthBoost(15)) elif powerUpType == PowerUp.DEAD_FINK: effect = HungerBoost(5) self.effects.append(HealthBoost(10)) elif powerUpType == PowerUp.DEAD_MEGAKID: effect = HungerBoost(5) self.effects.append(HealthBoost(10)) elif powerUpType == PowerUp.DEAD_RINGKID: effect = HungerBoost(5) self.effects.append(HealthBoost(10)) elif powerUpType == PowerUp.DEAD_ELFKID: effect = HungerBoost() self.effects.append(HealthBoost(3)) elif powerUpType == PowerUp.DEAD_SANTAKID: effect = HungerBoost() self.effects.append(HealthBoost(5)) else: effect = HungerBoost() self.effects.append(HealthBoost()) if powerUpType >= PowerUp.DEAD_BASICKID: self.RECT_SIZE = (50,30) self.effects.append(effect) self.update() def isDeadKid(self): return self.getAnimationType() >= PowerUp.DEAD_BASICKID def isDrugs(self): return self.getAnimationType() == PowerUp.DRUGS def getType(self): return self.getAnimationType() def update(self): self.ticksLeft -= 1 if self.ticksLeft == 0: self.kill() else: GameObject.update(self)