コード例 #1
0
ファイル: animation.py プロジェクト: MacLeek/mh
    def __init__(self,name,image,frames,directions=1,timing=100,sound=None):
        GameObject.__init__(self)

        assert isinstance(image, Image)

        #if sound:
        #    assert(sound, Sound)


        self.name = name
        self.image = image
        self.images = None
        self.directions = directions
        self.frames = frames
        self.timing = timing

        # TODO: some checking to make sure inputs are the correct length
        if isinstance(self.frames, int):
            self.frames = tuple(range(0, self.frames))
        else:
            self.frames = tuple(self.frames)

        self.real_frames = len(set(self.frames))

        if isinstance(self.timing, int):
            self.timing = tuple([self.timing] * len(self.frames))
        else:
            self.timing = tuple(self.timing)
コード例 #2
0
ファイル: static.py プロジェクト: Ragzouken/agutaywusyg
 def __init__(self, p, locked=False, blocks=None, *args, **kwargs):
     GameObject.__init__(self, 'door', location=p, char='+', *args, **kwargs)
     self.tileindex = (0,0)
     self.block_move = True
     self.block_sight = True
     self.blocks = blocks
     self.locked = locked
コード例 #3
0
    def __init__(self, tmx, size, **kwargs):
        GameObject.__init__(self)

        self.default_image = generateDefaultImage(
            (tmx.tilewidth, tmx.tileheight))
        self.tmx = tmx
        self.setSize(size)
コード例 #4
0
ファイル: animation.py プロジェクト: MacLeek/mh
    def __init__(self,
                 name,
                 image,
                 frames,
                 directions=1,
                 timing=100,
                 sound=None):
        GameObject.__init__(self)

        assert isinstance(image, Image)

        #if sound:
        #    assert(sound, Sound)

        self.name = name
        self.image = image
        self.images = None
        self.directions = directions
        self.frames = frames
        self.timing = timing

        # TODO: some checking to make sure inputs are the correct length
        if isinstance(self.frames, int):
            self.frames = tuple(range(0, self.frames))
        else:
            self.frames = tuple(self.frames)

        self.real_frames = len(set(self.frames))

        if isinstance(self.timing, int):
            self.timing = tuple([self.timing] * len(self.frames))
        else:
            self.timing = tuple(self.timing)
コード例 #5
0
ファイル: animation.py プロジェクト: dangillet/polerunner
    def __init__(self,name,image,frames,directions=1,timing=100,sound=None):
        GameObject.__init__(self)
        self.add(image)

        self.name = name
        self.image = image
        self.images = None
        self.directions = directions
        self.frames = frames
        self.timing = timing

        # TODO: some checking to make sure inputs are the correct length
        if isinstance(self.frames, int):
            self.frames = tuple(range(0, self.frames))
        else:
            self.frames = tuple(self.frames)

        self.real_frames = len(set(self.frames))

        if isinstance(self.timing, int):
            self.timing = tuple([self.timing] * len(self.frames))
        else:
            self.timing = tuple(self.timing)

        if (self.images is not None) and (not force):
            return
コード例 #6
0
ファイル: tilemap.py プロジェクト: MacLeek/mh
    def __init__(self, tmx, size, **kwargs):
        GameObject.__init__(self)

        self.default_image = generateDefaultImage((tmx.tilewidth,
                                                   tmx.tileheight))
        self.tmx = tmx
        self.setSize(size)
コード例 #7
0
ファイル: item.py プロジェクト: Ragzouken/agutaywusyg
 def __init__(self, unlocks, *args, **kwargs):
     GameObject.__init__(self, 'key', char='[', *args, **kwargs)
     self.unlocks = unlocks
     self.facts.append(Solves(self, unlocks.blocks_fact.obj))
     for obj in self.world.player.wants:
         if obj.location_fact.obj == self.unlocks.blocks:
             # Todo: player doesn't *want* us until they know about us!
             self.facts.append(Wants(self.world.player, self))
コード例 #8
0
ファイル: avatar.py プロジェクト: bitcraft/pyweek14
    def __init__(self, filename, name, tile=None, size=None):
        GameObject.__init__(self)

        self.filename = filename
        self.name = name
        self.tile = tile
        self.size = size

        self.image = None
コード例 #9
0
ファイル: zone.py プロジェクト: bitcraft/polerunner
 def __init__(self, data):
     GameObject.__init__(self)
     self.rect = Rect(data.x, data.y, data.width, data.height)
     if hasattr(data, 'points'):
         self.points = data.points
     else:
         self.points = None
     self.name = data.name
     self.properties = data.properties
     self.entered = False
コード例 #10
0
ファイル: animation.py プロジェクト: bitcraft/pyweek15
    def __init__(self, name, image, tile=None, size=None):
        GameObject.__init__(self)

        self.image = image
        self.name = name
        self.tile = tile
        self.size = size

        self.frames = [0]
        self.timing = [-1]
コード例 #11
0
ファイル: zone.py プロジェクト: MacLeek/mh
    def __init__(self, data):
        GameObject.__init__(self)
        self.extent = Rect(data.x, data.y, data.width, data.height)
        if hasattr(data, 'points'):
            self.points = data.points
        else:
            self.points = None
        self.name = data.name
        self.properties = data.properties

        self.entered = False
コード例 #12
0
ファイル: ani.py プロジェクト: bitcraft/mh
    def __init__(self, filename, size, name=None, directions=1):
        GameObject.__init__(self)

        self.filename = filename
        self.size = size

        if name == None:
            self.name = filename

        self.directions = directions  # number of directions for animation
        self.frames = ([],) * directions
コード例 #13
0
ファイル: actor.py プロジェクト: Ragzouken/agutaywusyg
    def __init__(self, name, description='', location=None, *args, **kwargs):
        self.map_memory = {}

        GameObject.__init__(self, name=name, description=description, location=location, *args, **kwargs)

        self.tiletype = 2
        self.knowledge = set()
        self.wants = []
        self.relationships = None
        self.hp = 1
        self.block_move = True
コード例 #14
0
ファイル: animation.py プロジェクト: MacLeek/mh
    def __init__(self, name, image):
        GameObject.__init__(self)

        try:
            assert isinstance(image, Image) or isinstance(image, ImageTile)
        except AssertionError:
            print name, image
            raise

        self.image = image
        self.name = name
        self.frames = [0]
        self.timing = [-1]
コード例 #15
0
ファイル: env.py プロジェクト: bitcraft/mh
    def __init__(self):
        GameObject.__init__(self)
        self.exits    = {}
        self.geometry = {}       # geometry (for collisions) of each layer
        self.objects = {}        # position and size of objects in 3d space
        self.orientations = {}   # records where the object is facing
        self.extent = None       # absolute boundries of the area
        self.joins = []
        self._oldPositions = {}  # used in collision handling

        self.messages = []

        self.time = 0
コード例 #16
0
ファイル: animation.py プロジェクト: dangillet/polerunner
    def __init__(self, name, image):
        GameObject.__init__(self)

        try:
            assert isinstance(image, Image) or isinstance(image, ImageTile)
        except AssertionError:
            print name, image
            raise

        self.image = image
        self.name = name
        self.frames = [0]
        self.timing = [-1]
コード例 #17
0
ファイル: avatar.py プロジェクト: bitcraft/mh
 def __init__(self):
     GameObject.__init__(self)
     self.default      = None
     self.callback     = None    # called when animation finishes
     self.curImage     = None    # cached for drawing ops
     self.curFrame     = None    # current frame number
     self.curAnimation = None
     self.animations   = {}
     self.loop_frame = 0
     self.looped     = 0
     self.loop       = -1
     self.timer      = 0
     self._prevAngle = None
     self._prevFrame = None
     self._is_paused = False
コード例 #18
0
ファイル: avatar.py プロジェクト: bitcraft/lpc1
    def __init__(self, animations):
        GameObject.__init__(self)
        self.default      = None
        self.curImage     = None    # cached for drawing ops
        self.curFrame     = None    # current frame number
        self.curAnimation = None
        self.animations   = {}
        self.looped     = 0
        self.loop       = -1
        self.timer      = 0.0
        self.ttl = 0
        self._prevAngle = None

        for animation in animations:
            self.add(animation)
            self.animations[animation.name] = animation

        self.setDefault(animations[0])
        self.play()
コード例 #19
0
ファイル: avatar.py プロジェクト: bitcraft/mh
    def __init__(self, filename, name, frames, directions=1, timing=None):
        GameObject.__init__(self)

        self.filename = filename
        self.name = name
        self.order = None

        if isinstance(frames, int):
            self.frames = frames
            self.real_frames = frames

        elif isinstance(frames, list):
            self.frames = len(frames)
            self.real_frames = max(frames) + 1
            self.order = frames

        self.directions = directions
        self.timing = timing
        self.images = []
コード例 #20
0
ファイル: templates.py プロジェクト: beltsonata/PyPyPy
 def __init_(self):
     GameObject.__init__(
         self,
         components=[
             components.CPosition(),
             components.CPlayerMovement(),
             components.CActorAnimParser(self.pathLists),
         ])
     
     # Create a flipped copy of LEFT_WALK as our RIGHT_WALK animation
     # -- this will be changed when we have more walking animations.
     components.CActorAnimParser.animations[
         enums.ActorAnim.WALK_RIGHT
         ] = tools.AnimCreator.createHorizontallyFlippedAnimation(
                 components.CActorAnimParser.animations[WALK_LEFT])
     # do the same for STANDING_RIGHT with STANDING_LEFT
     components.CActorAnimParser.animations[
         enums.ActorAnim.STANDING_RIGHT
         ] = tools.AnimCreator.createHorizontallyFlippedAnimation(
                 components.CActorAnimParser.animations[
                     STANDING_RIGHT])
コード例 #21
0
ファイル: avatar.py プロジェクト: MacLeek/mh
    def __init__(self, animations, axis_offset=(0, 0)):
        GameObject.__init__(self)
        self.axis_offset = Vec2d(axis_offset)

        self.curImage = None  # cached for drawing ops
        self.curFrame = None  # current frame number
        self.curAnimation = None
        self.animations = {}
        self.looped = 0
        self.timer = 0.0
        self.ttl = 0
        self.flip = 0
        self.speed_mod = 1.0
        self._prevAngle = None
        self._changed = True
        self.axis = Vec2d(0, 0)

        for animation in animations:
            self.add(animation)
            self.animations[animation.name] = animation

        self.play(self.animations.keys()[0])
コード例 #22
0
ファイル: avatar.py プロジェクト: dangillet/polerunner
    def __init__(self, animations, axis_offset=(0,0)):
        GameObject.__init__(self)
        self.axis_offset = Vec2d(axis_offset)

        self.curImage     = None    # cached for drawing ops
        self.curFrame     = None    # current frame number
        self.curAnimation = None
        self.animations   = {}
        self.looped     = 0
        self.timer      = 0.0
        self.ttl = 0
        self.flip = 0
        self.speed_mod = 1.0
        self._prevAngle = None
        self._changed = True
        self.axis = Vec2d(0,0)

        for animation in animations:
            self.add(animation)
            self.animations[animation.name] = animation

        self.play(self.animations.keys()[0])
コード例 #23
0
ファイル: env.py プロジェクト: bitcraft/mh
 def __init__(self):
     GameObject.__init__(self)