Monthly Archives: December 2013

[Corona SDK] Corona Tiled

Tiled라는 유명한 타일맵 게임레벨 유틸리티에서 만든 JSON파일을 읽어들여 Corona에서 게임 레벨을
구성할 수 있는 프레임워크입니다. 분석 중인데 0.4버전임에도 불구하고 완성도가 높습니다.

개발자가 만든 예제의 동영상을 보시면 이해가 빠를 실 것 같습니다.

Loads JSON saved map files from Tiled http://www.mapeditor.org/
Author: Michael Wilson / NO2 Games, Inc. – www.no2games.com
More updates in v0.4

SUPPORTED

JSON or LUA exported map files
Multiple Layers
Multiple Tilesets
Custom Tile shapes
Finding Objects by name
Setting Physics properties from the map editor
Object types (regular, polygon, line) that support physics properties
Uses Corona Image Maps and Image Map groups if you limit yourself to a single tileset image
Setting custom tile/layer/map properties
Margins and spacing

Example

— Project: Corona Tiled Map Loader Example 0.1

— Date: November 24, 2012

— Version: 0.1

— File name: main.lua

— Author: Michael Wilson / NO2 Games, Inc. – www.no2games.com

— Update History:

— 0.1 – Initial release

— Loads JSON saved map files from Tiled http://www.mapeditor.org/

display.setStatusBar( display.HiddenStatusBar )

tiledMap = require(“tiled”)

map = tiledMap:load(“desert.json”)

function map:touch( event )
if event.phase == “began” then
self.markX = self.x — store x location of object
self.markY = self.y — store y location of object
elseif event.phase == “moved” then
local x = (event.x – event.xStart) + self.markX
local y = (event.y – event.yStart) + self.markY
self.x, self.y = x, y — move object based on calculations above
end
return true
end

map:addEventListener( “touch”, map )

CoronaTiled