Created
June 13, 2022 14:00
-
-
Save dacap/292d0fb10cc1bf5de0e4086173de4229 to your computer and use it in GitHub Desktop.
Creates a new tilemap layer with one tile per grid cell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local spr = app.activeSprite | |
if not spr then | |
return app.alert "You need to create a sprite first" | |
end | |
app.transaction( | |
function() | |
app.command.NewLayer{ name="Tilemap", tilemap=true } | |
local grid = spr.gridBounds | |
for y=grid.y,spr.height,grid.width do | |
for x=grid.x,spr.width,grid.width do | |
app.useTool{ | |
tool='pencil', | |
brush=Brush(1), | |
color=Color{ index=1 }, | |
tilemapMode=TilemapMode.PIXELS, | |
tilesetMode=TilesetMode.STACK, | |
points={ Point(x, y) }} | |
app.useTool{ | |
tool='pencil', | |
brush=Brush(1), | |
color=spr.transparentColor, | |
tilemapMode=TilemapMode.PIXELS, | |
tilesetMode=TilesetMode.MANUAL, | |
points={ Point(x, y) }} | |
end | |
end | |
end) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment