Example #1
0
class Coin(GameEntity):
    def __init__(self, (x, y), map):
        GameEntity.__init__(self, (x, y), (30, 30))
        self.map = map
        self.animation = Animation(
            assets.images.goldpiece.yellow,
            ('1', '2', '3', '4', '5', '6', '7', '8', '9', '10'))
Example #2
0
class MovableEntity(GameEntity):
    """Abstract MovableEntity class. To create a new MovableEntity, overload the
    __init__ function and set at least the following attributes on the object:
    
        states: A dictionary of possible states.
        currentState: The current state of the entity.
    
    For simple entities, it should suffice to implement only the appropriate states."""
    def __init__(self, (x, y), (width, height), map):
        GameEntity.__init__(self, (x, y), (width, height))
        self.map = map

        self.default_size = (width, height)

        # Default direction of all entities to right.
        self.direction = GameEntity.DIRECTION_RIGHT
Example #3
0
 def render(self, screen, offsets):
     GameEntity.render(self, screen, self.image, offsets)
Example #4
0
class Tile(GameEntity):
    def __init__(self, name, (x, y)):
        self.image = assets.images.map.__dict__[name]

        GameEntity.__init__(self, (x, y), self.image.get_size())
Example #5
0
 def render(self, screen, offsets):
     GameEntity.render(self, screen, self.animation.get_image(), offsets)
Example #6
0
 def render(self, screen, map_offsets):
     GameEntity.render(self, screen, self.currentState.get_image(),
                       map_offsets)
Example #7
0
 def act(self, time_passed):
     GameEntity.act(self, time_passed)
     if self.location == self.destination:
         self.destroy()
         return
     self.world.test_colision(self)
Example #8
0
 def __init__(self, world, image, location, destination):
     GameEntity.__init__(self, world, "bullet", image, location, BULLET_SPEED)
     self.destination = destination
Example #9
0
 def __init__(self, world, image, location):
     GameEntity.__init__(self, world, "cannon", image, location, 0)
     self.cooldown = MAX_COOLDOWN