Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Pixelbox

Create 2D games in JavaScript, made easier · By Cedric Stoquer

Ability to resize tilesheet

A topic by NFReal created Apr 30, 2020 Views: 573 Replies: 7
Viewing posts 1 to 4

Currently, none of my tilesheets are compatible, because they are too big...

Please add this feature

What size is your tilesheet?
what are you trying to do (create map, edit sprites, something else) ?

Width 140

height 492

I generated it from the "set as atlas" feature, And I'm trying to use it to edit maps

Images generated with "set as atlas" are not supposed to be reused directly.

What you could do is edit the tilesheet in another image edition program, and maybe split it into several tilesheets.

You can also change the size of tiles from Project > Settings

I agree that supporting different dimensions would be a boon. Would obviously need to be clamped to a tiles_w X tiles_h based on project tile and pixel size settings, but supporting sheet sizes other than 16 tiles x 16 tiles would be nice.

(1 edit) (+1)

The 16 x 16 tiles limit is bind to the way TileMap are compressed and saved. 

But it is possible to use the sprite function with a tile index greater than 255. This meaning you can use tilesheet that have more than 16 tile in height.

But in general, I would recommend to create another tilesheet if more than 256 tiles are needed. The tilesheet of a tileMap can be changed by dragging the image from the assets panel, to the tilesheet panel. 

Tilesheets can also be switched at execution time with:

map.setTilesheet(tilesheet);

@Cedric Stoquer

So if i want to have a sprite bigger than the 16*16 ill just make it higher with still 16 in tiles in width. so far so good, but am i able to use multiple different sprite on a single stage? Or is it only possible to have 1 spritesheet as source to draw on the current stage? (Based on the idea to split map/character sprites, so i just load the current map sprite instead of a giant map sprite. This way i would need a second sprite for character/items or put those character items in each of the map sprites).

You can use as many tilesheet as you need. The only limitation is that a tilemap can only use one tilesheet at a time (but can be swapped at execution time).

API are as follow:

Texture.setTilesheet(image); // set the tilesheet for this texture only. set image to null to unlink the tilsheet and use the default one. Texture.setGlobalTilesheet(image); // set the default texture globally // Note: the main screen is a Texture accessible with the global $screen variable

TileMap.setTilesheet(image); // swap the tilesheet for this tilemap

Note2: images can be another texture. So it is possible to procedurally generate and use tilesheets.