Ejemplo n.º 1
0
    def __init__(self,
                 screen,
                 x=None,
                 y=None,
                 set="brown",
                 itemclass="key",
                 max_activations=1,
                 trigger=TRIGGER_FLIP):
        Gameobject.__init__(self, screen, True, False, x, y)
        self.animations["default"] = Animation(set, itemclass)

        try:
            self.animations["broken"] = Animation(set, itemclass + "_broken")
        except:
            self.animations["broken"] = self.animations["default"]

        self.image = self.animations[
            self.current_animation].update_and_get_image()
        self.rect = self.image.get_rect()
        self.itemclass = itemclass
        self.activated_times = 0
        self.max_activations = max_activations
        self.trigger = TRIGGER_NONE
        if self.itemclass == "key":
            self.pickable = True
        if self.itemclass == "lever":
            self.trigger = trigger
        return
Ejemplo n.º 2
0
 def __init__(self, screen, tilex, tiley, set = "brown", tileclass = "wall"):
   Gameobject.__init__(self, screen, True)
   self.animations["default"] = Animation(set, tileclass)
   self.image = self.animations[self.current_animation].update_and_get_image()
   self.rect = self.image.get_rect()
   self.tilex = tilex
   self.tiley = tiley
   self.x = (tilex - (FULL_TILES_HOR - TILES_HOR) + 0.5) * TILE_DIM
   self.y = (tiley - (FULL_TILES_VER - TILES_VER) + 0.5) * TILE_DIM
   return
Ejemplo n.º 3
0
 def __init__(self, screen, x = None, y = None, dx = None, dy = None, damage = 5, set = "energy"):
   Gameobject.__init__(self, screen, False, False, x, y, -1)
   self.animations["default"] = Animation(set, "flying")
   self.animations["dying"] = Animation(set, "dying")
   self.image = self.animations[self.current_animation].update_and_get_image()
   self.rect = self.image.get_rect()
   self.dx = dx
   self.dy = dy
   self.saveddx =  None
   self.damage = damage
   self.itemclass = "projectile"
   return
Ejemplo n.º 4
0
  def __init__(self, screen, x = None, y = None, attached = RIGHT):
    Gameobject.__init__(self, screen, True, False, x, y, 30, True)
    self.animations["default"] = Animation("spider", "standing")
    self.animations["walking"] = Animation("spider", "walking")
    self.image = self.animations[self.current_animation].update_and_get_image()
    self.rect = self.image.get_rect()
    self.life = 10
    self.itemclass = "spider"

    self.attached = attached
    self.move_target = STAY
    self.fire_delay = 0

    return
Ejemplo n.º 5
0
    def __init__(self, screen, x=None, y=None, attached=RIGHT):
        Gameobject.__init__(self, screen, True, False, x, y, 30, True)
        self.animations["default"] = Animation("spider", "standing")
        self.animations["walking"] = Animation("spider", "walking")
        self.image = self.animations[
            self.current_animation].update_and_get_image()
        self.rect = self.image.get_rect()
        self.life = 10
        self.itemclass = "spider"

        self.attached = attached
        self.move_target = STAY
        self.fire_delay = 0

        return
Ejemplo n.º 6
0
  def __init__(self, screen, x = None, y = None):
    Gameobject.__init__(self, screen, False, True, x, y, PLAYER_LIFE)
    #Changing some of the values from gameobject:
    self.animations["default"] = Animation("guy", "standing")
    self.animations["walking"] = Animation("guy", "walking")
    self.animations["arrow"] = Animation("guy", "arrow")
    self.animations["dying"] = Animation("guy", "dying")
    self.animations["shouting"] = Animation("guy", "shouting")
    self.animations["jumping"] = Animation("guy", "standing")
    self.image = self.animations[self.current_animation].update_and_get_image()
    self.rect = self.image.get_rect()
    self.itemclass = "player"

    #Variables spesific to this class:
    self.inventory = []
    self.on_ground = False
    self.umbrella_on = False
    return
Ejemplo n.º 7
0
 def __init__(self,
              screen,
              x=None,
              y=None,
              dx=None,
              dy=None,
              damage=5,
              set="energy"):
     Gameobject.__init__(self, screen, False, False, x, y, -1)
     self.animations["default"] = Animation(set, "flying")
     self.animations["dying"] = Animation(set, "dying")
     self.image = self.animations[
         self.current_animation].update_and_get_image()
     self.rect = self.image.get_rect()
     self.dx = dx
     self.dy = dy
     self.saveddx = None
     self.damage = damage
     self.itemclass = "projectile"
     return
Ejemplo n.º 8
0
  def __init__(self, screen, x = None, y = None, set = "brown", itemclass = "key", max_activations = 1, trigger = TRIGGER_FLIP):
    Gameobject.__init__(self, screen, True, False, x, y)
    self.animations["default"] = Animation(set, itemclass)

    try:
      self.animations["broken"] = Animation(set, itemclass + "_broken")
    except:
      self.animations["broken"] = self.animations["default"]
      
    self.image = self.animations[self.current_animation].update_and_get_image()
    self.rect = self.image.get_rect()
    self.itemclass = itemclass
    self.activated_times = 0
    self.max_activations = max_activations
    self.trigger = TRIGGER_NONE
    if self.itemclass == "key":
      self.pickable = True
    if self.itemclass == "lever":
      self.trigger = trigger
    return