当前位置: 首页>>代码示例>>Python>>正文


Python Animation.addBrokenSpriteSheet方法代码示例

本文整理汇总了Python中animation.Animation.addBrokenSpriteSheet方法的典型用法代码示例。如果您正苦于以下问题:Python Animation.addBrokenSpriteSheet方法的具体用法?Python Animation.addBrokenSpriteSheet怎么用?Python Animation.addBrokenSpriteSheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在animation.Animation的用法示例。


在下文中一共展示了Animation.addBrokenSpriteSheet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import addBrokenSpriteSheet [as 别名]
 def __init__(self):
     super(GcnstAnimation,self).__init__()
     image = images["gcnst"]
     offsetx,offsety = 213,263
     self.originalAnimation = "build"
     width,height = 426,339
     playeroffset = 1356
     
     x,y,i0,j0,left,right,count = 0,678,0,0,0,20,29
     for player in range(numofplayer):
         animation = Animation()
         animation.addBrokenSpriteSheet(image,x,y,i0,j0,width,height,left,right,count,offsetx,offsety)
         animation.loop = False
         self.addAnimation("build_%d"%player,animation)
         y += playeroffset
     
     x,y,m,n = 0,0,20,1
     self.addAnimationFromSpriteSheet(image,x,y,width,height,m,n,offsetx,offsety,playeroffset,"normal",True,None,"build")
     x,y,m,n = 0,339,20,1
     self.addAnimationFromSpriteSheet(image,x,y,width,height,m,n,offsetx,offsety,playeroffset,"destroy")
开发者ID:yczhangsjtu,项目名称:Python-RA2,代码行数:22,代码来源:building.py

示例2: __init__

# 需要导入模块: from animation import Animation [as 别名]
# 或者: from animation.Animation import addBrokenSpriteSheet [as 别名]
    def __init__(self):
        super(EngineerAnimation, self).__init__()
        image = images["engineer"]
        offsetx, offsety = 37, 38
        self.originalAnimation = "runsw"
        width, height = 76, 80
        playeroffset = 880
        left, right = 0, 23
        x, y = 0, 0

        for player in range(2):
            i0, j0 = 0, 0

            count = 1
            for direction in directions:
                animation = Animation()
                animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
                self.addAnimation("stand%s_%d" % (direction, player), animation)
                i0 += count
                j0 += i0 / right
                i0 %= right

            count = 6
            for direction in directions:
                animation = Animation()
                animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
                animation.loop = False
                animation.next = self.getAnimation("stand%s_%d" % (direction, player))
                self.addAnimation("run%s_%d" % (direction, player), animation)
                i0 += count
                j0 += i0 / right
                i0 %= right

            count = 15
            animation = Animation()
            animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
            animation.loop = False
            animation.next = self.getAnimation("standsw_%d" % (player))
            self.addAnimation("stool_%d" % (player), animation)
            i0 += count
            j0 += i0 / right
            i0 %= right

            count = 15
            animation = Animation()
            animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
            animation.loop = False
            animation.next = self.getAnimation("standsw_%d" % (player))
            self.addAnimation("read_%d" % (player), animation)
            i0 += count
            j0 += i0 / right
            i0 %= right

            count = 6
            for direction in directions:
                animation = Animation()
                animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
                animation.loop = False
                animation.next = self.getAnimation("stand%s_%d" % (direction, player))
                self.addAnimation("crawl%s_%d" % (direction, player), animation)
                i0 += count
                j0 += i0 / right
                i0 %= right

            count = 15
            animation = Animation()
            animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
            animation.loop = False
            self.addAnimation("die1_%d" % (player), animation)
            i0 += count
            j0 += i0 / right
            i0 %= right

            count = 15
            animation = Animation()
            animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
            animation.loop = False
            self.addAnimation("die2_%d" % (player), animation)
            i0 += count
            j0 += i0 / right
            i0 %= right

            count = 6
            for direction in directions:
                animation = Animation()
                animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
                animation.loop = False
                animation.next = self.getAnimation("stand%s_%d" % (direction, player))
                self.addAnimation("search%s_%d" % (direction, player), animation)
                i0 += count
                j0 += i0 / right
                i0 %= right

            count = 2
            for direction in directions:
                animation = Animation()
                animation.addBrokenSpriteSheet(image, x, y, i0, j0, width, height, left, right, count, offsetx, offsety)
                animation.loop = False
                self.addAnimation("getdown%s_%d" % (direction, player), animation)
                i0 += count
#.........这里部分代码省略.........
开发者ID:yczhangsjtu,项目名称:Python-RA2,代码行数:103,代码来源:infantry.py


注:本文中的animation.Animation.addBrokenSpriteSheet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。