vid.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:CritterEvolution 作者: apockill 项目源码 文件源码
def run_codes(self,cdata,rect):
        """Run codes.

        Arguments:
            cdata -- a dict of code:(handler function, value)
            rect -- a tile rect of the parts of the layer that should have
                 their codes run

        """
        tw,th = self.tiles[0].image.get_width(),self.tiles[0].image.get_height()

        x1,y1,w,h = rect
        clayer = self.clayer
        t = Tile()
        for y in range(y1,y1+h):
            for x in range(x1,x1+w):
                n = clayer[y][x]
                if n in cdata:
                    fnc,value = cdata[n]
                    t.tx,t.ty = x,y
                    t.rect = pygame.Rect(x*tw,y*th,tw,th)
                    fnc(self,t,value)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号