def initializeMapData(level): mapData = level.getMapData() for x in range(level.getSize()[0]): for y in range(level.getSize()[1]): mapTile = mapData[x][y] if mapTile != None: playfield.setTile(x, y, playfield.Tile(mapTile))
def setupPlayfield(data): height = len(data) width = len(data[0]) playfield.initialize(width, height) for x in range(width): for y in range(height): tile = createTileFromCharacter(data[y][x]) playfield.setTile(x, y, tile)
def drawTileAtPixel(x, y, tileType): tileX = int(x / playfield.blockSize) tileY = int(y / playfield.blockSize) if playfield.containsTileCoordinates(tileX, tileY): playfield.setTile(tileX, tileY, tileType)