示例#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'))
示例#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
示例#3
0
文件: tile.py 项目: jtietema/pyrio
 def render(self, screen, offsets):
     GameEntity.render(self, screen, self.image, offsets)
示例#4
0
文件: tile.py 项目: jtietema/pyrio
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())
示例#5
0
 def render(self, screen, offsets):
     GameEntity.render(self, screen, self.animation.get_image(), offsets)
示例#6
0
 def render(self, screen, map_offsets):
     GameEntity.render(self, screen, self.currentState.get_image(),
                       map_offsets)
示例#7
0
文件: bullet.py 项目: bdilly/lastcity
 def act(self, time_passed):
     GameEntity.act(self, time_passed)
     if self.location == self.destination:
         self.destroy()
         return
     self.world.test_colision(self)
示例#8
0
文件: bullet.py 项目: bdilly/lastcity
 def __init__(self, world, image, location, destination):
     GameEntity.__init__(self, world, "bullet", image, location, BULLET_SPEED)
     self.destination = destination
示例#9
0
文件: cannon.py 项目: bdilly/lastcity
 def __init__(self, world, image, location):
     GameEntity.__init__(self, world, "cannon", image, location, 0)
     self.cooldown = MAX_COOLDOWN