tmTilesetCreate

Category: Tilemap

Syntax:

tmTilesetCreate:Int(image:Int, tileW:Int, tileH:Int, padding:Int)


Parameters

Returns

Int



Summary

Makes a tileset from an image, cutting it into tiles along a grid. Ids run from 1, left to right, then down. It turns smoothing off on the image so tiles can't bleed into each other. On the web, tiles draw once the image has arrived, and anything you set on the tileset before then is kept.

Takes image (An image from b2dLoadImage. Palette (indexed) images don't draw as tiles yet), tileW (The width of a tile, in pixels), tileH (The height of a tile, in pixels), padding (The gap between tiles in the image, in pixels).

Returns: The tileset's handle, or 0 if it can't be made.

View detailed documentation online



Example
tiles = tmTilesetCreate(b2dLoadImage("Media/tiles.png"), 16, 16, 0)

BambooBasic © 2026 Michael Denathorn