addToTile() Function Reference

addToTile(x, y, frame[, layer])

Adds a specific frame to a tile. This appears as a new layer at the top of the tiles layer stack unless the optional "layer" parameter is passed. Useful for example, to create "put item" abilities.

The optional "layer" parameter causes the new addition to replace any layer of the same name, or create a layer of that name to add to. Useful if using layer based opacities for example.

If there's currently no tile at the given x,y co-ordinate, it's created.

	local qiso = require "plugin.qisoengine"

	-- Enable the main Qiso loop to render/update our world

	-- Adds a floorboard layer to the tapped tile. A strange game admittedly.
	function tapTile(event)
		-- Get the tile located where the screen was tapped. If there is no tile here, getTile returns nil.
		local tile = qiso.getTile(event.x, event.y)

		if(tile ~= nil) then
			-- 5 is the tileset frame used in our sample map for floorboards.
			qiso.addToTile(tile.x, tile.y, 5)

	-- Do something when the screen is tapped
	Runtime:addEventListener('tap', tapTile)