本文整理汇总了Python中coilsnake.model.eb.graphics.EbGraphicTileset.add_tile方法的典型用法代码示例。如果您正苦于以下问题:Python EbGraphicTileset.add_tile方法的具体用法?Python EbGraphicTileset.add_tile怎么用?Python EbGraphicTileset.add_tile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coilsnake.model.eb.graphics.EbGraphicTileset
的用法示例。
在下文中一共展示了EbGraphicTileset.add_tile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_add_tile
# 需要导入模块: from coilsnake.model.eb.graphics import EbGraphicTileset [as 别名]
# 或者: from coilsnake.model.eb.graphics.EbGraphicTileset import add_tile [as 别名]
def test_add_tile(self):
tileset = EbGraphicTileset(num_tiles=5, tile_width=8, tile_height=8)
tile = [
array("B", [5, 7, 6, 4, 1, 5, 3, 3]),
array("B", [5, 8, 3, 7, 5, 7, 1, 1]),
array("B", [6, 1, 1, 5, 4, 0, 1, 5]),
array("B", [2, 1, 4, 5, 4, 1, 6, 4]),
array("B", [4, 6, 6, 2, 1, 0, 4, 4]),
array("B", [6, 1, 0, 7, 5, 8, 1, 8]),
array("B", [8, 0, 4, 0, 2, 8, 0, 8]),
array("B", [0, 6, 8, 6, 0, 5, 4, 0]),
]
tile1_id, tile1_vflip, tile1_hflip = tileset.add_tile(tile)
tile2_id, tile2_vflip, tile2_hflip = tileset.add_tile(tile)
assert_equal(tile2_id, tile1_id)
assert_equal(tile2_vflip, tile1_vflip)
assert_equal(tile2_hflip, tile1_hflip)
tile.reverse()
tile2_id, tile2_vflip, tile2_hflip = tileset.add_tile(tile)
assert_equal(tile2_id, tile1_id)
assert_equal(tile2_vflip, not tile1_vflip)
assert_equal(tile2_hflip, tile1_hflip)
for row in tile:
row.reverse()
tile2_id, tile2_vflip, tile2_hflip = tileset.add_tile(tile)
assert_equal(tile2_id, tile1_id)
assert_equal(tile2_vflip, not tile1_vflip)
assert_equal(tile2_hflip, not tile1_hflip)
tile.reverse()
tile2_id, tile2_vflip, tile2_hflip = tileset.add_tile(tile)
assert_equal(tile2_id, tile1_id)
assert_equal(tile2_vflip, tile1_vflip)
assert_equal(tile2_hflip, not tile1_hflip)
tile = [
array("B", [1, 2, 3, 4, 1, 5, 3, 3]),
array("B", [5, 8, 3, 7, 5, 7, 1, 1]),
array("B", [6, 1, 1, 5, 4, 0, 1, 5]),
array("B", [2, 1, 4, 5, 4, 1, 6, 4]),
array("B", [4, 6, 6, 2, 1, 0, 4, 4]),
array("B", [6, 1, 0, 7, 5, 8, 1, 8]),
array("B", [8, 0, 4, 0, 2, 8, 0, 8]),
array("B", [0, 6, 8, 6, 0, 5, 4, 0]),
]
tile2_id, tile2_vflip, tile2_hflip = tileset.add_tile(tile)
assert_not_equal(tile2_id, tile1_id)