removeFromTile() Function Reference

removeFromTile(x, y, frame)

Removes a specific frame from a tile. Useful for example, to create "take item" abilities.


	local qiso = require "plugin.qisoengine"
	qiso.setAssetsFolder("assets")
	qiso.loadTiledMap("sample-tilemap")

	-- Enable the main Qiso loop to render/update our world
	qiso.activate()

	-- Remove any floorboard layers that might be on 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.removeFromTile(tile.x, tile.y, 5)
		end
	end

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