goTo() Function Reference

goTo(integer x, integer y)

Centers the camera on a particular tile. Useful for starting at the player position, for example.


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

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

	-- Center on the tapped tile
	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
			qiso.goTo(tile.x, tile.y)
		end
	end

	Runtime:addEventListener('tap', tapTile)