2015년 6월 16일 화요일

corona sdk 에서 tiled 사용하기 00 – Making Your First Map

corona sdk 에서 tile 을 사용하려면 아래 링크를 참고 바랍니다.
여기서 tile이라고 하면 map을 구성하거나 배경을 구성할때 그림을 그리는 방식이 아니라 tile을 이용해서 그리는 것을 의미합니다.

tile map 에디터 http://www.mapeditor.org/
lime 다운로드 http://outlawgametools.github.io/Lime2DTileEngine/
tutorial http://lime.outlawgametools.com/tutorials-3/

WARNING! Lime isn’t currently being worked on. If you’re looking for a tile-based engine, check out Dusk for Corona — it’s open source and very good:
참고로 lime의 경우 현재 더이상 작업중이 아니라고 합니다. dusk 엔진을 사용하라고 합니다. 하지만 tutorial이 없어서 잘모르겠습니다.
https://forums.coronalabs.com/topic/42355-dusk-engine/


첫번째 예제 부터 정리해보록 하겠습니다.
번역은 아니고 제 나름대로 정리해서 글을 쓰도록 하겠습니다. 그냥 코드 참고하고 하다가 막히는거 위주로 번역이 아닙니다. 오해 없길 바랍니다.
https://github.com/anthonymoralez/lime-tutorials/tree/master/tutorial-00

http://lime.outlawgametools.com/tutorials/00-making-your-first-map/


00 – Making Your First Map (당신의 첫번째 맵 만들기)

Posted by admin - December 30, 2012 - Tutorials
0
loadMap

Difficulty: Beginner 난이도:초보자


Duration: 15 minutes 시간:15


Description: 설명:

Being able to make a map in Tiled and load it up in Lime is the most important aspect and luckily it is very simple.
타일에서 지도를 만들 수 있고 그것을 Lime에서 로드하는것은 가장 중요한 요소이고 운좋게도 그것은  매우 간단합니다.

Step 1: Download and install Tiled (Tiled를 다운로드하고 설치하기)

here
After downloading the package simply install it like any other program and start it up.
Tiled는 무료이고 해당 http://www.mapeditor.org/ 링크에서 다운로드한뒤 쉽게 설치 가능합니다.

Step 2: Create a new map(새로운 맵만들기)

Selecting File >> New… will bring up the following window:
이건 아래 그림보고 따라하면 됩니다.
New Map
Leave the Orientation as Orthogonal, while setting the Map Size to Width 15 and Height 10 and the Tile Size to Width 32 and Height 32.
Orthogonal maps are the easiest to create and are used for plenty of game types to keep you occupied at present. The Tile Size is measured in pixels while the Map Size is measured in tiles, so we are creating a map that is 480 wide pixels and 320 pixels high, one standard iPhone screen in landscape mode.
After clicking OK you should find your screen now looks something like this:
Empty Map




Step 3: Add a tileset(타일셋 넣기)


Tilesets are the building blocks of your map, in Corona they are implemented as sprite sheets. You can have as many tilesets as you like (and even external ones, which we will touch on in a later tutorial) all with different source images.
타일셋은 맵을 만들기 위한 블럭입니다.
here
예제를 시작하기전에 제일 아래있는 타일셋을 다운로드 받아서 진행하면 됩니다.
To add one, simply select Map >> New Tileset… to bring up the following window:
New Tileset
Now hit Browse… and select that file. Once selected make sure Tile Width and Tile Height are both32 (measured in pixels) and both Margin and Spacing is set to 0. Now just hit the OK button.
When you have done this you will notice you have a new tileset located in the bottom right of Tiled.
Tileset in Tiled




Step 4: Add your tiles(타일 넣으세요)

With your tileset loaded into Tiled your next step is to actually add your tiles, you do this by drawing them in. You have two brush types at your disposal, Stamp and Fill, for now simply leave it on Stamp like in the picture below.
Brushes
To draw a tile you first have to select it, to do so just tap it in the tileset and then just tap in the dotted grid to draw it.
Try creating a map that looks something like this:
도장같이 생긴 아이콘을 눌러 tileset에서 선택을 해서 맵에 찍어줍니다.
Finshed Map




Step 5: Save the map(맵을 저장하세요)

Once you are happy with your creation you should go ahead and save it, naturally you should be doing this often as per any computer work.
Before you save you must ensure your map will be in the correct format, currently Lime supports XML and CSV, to change the format select Tiled >> Preferences… to bring up the following window:
저장을 하면 아래와 같은 화면이 안뜨고 기본적으로 xml 포맷으로 저장이 됩니다. 따라서 아래 화면은 무시하면 됩니다.
Preferences
Simply ensure the data for tile layers is set to XML or CSV leaving all other settings as they are.
Now finally save your map via File >> Save, select a suitable name and choose your games root directory.


Step 6: Load your map in Lime(Lime에서 맵을 로드하세요)

lime을 http://outlawgametools.github.io/Lime2DTileEngine/ 링크에서 다운로드 합니다.
압축을 풀면 lime폴더가 있는데 이걸 자신이 만든 corona 프로젝트 바로 아래에 복사를 합니다. 폴더 만들어서 넣지 마세요.
The actual loading of your map is very simple, first off make sure you have actually placed the Lime folder in your games directory and then include the library as usual:

그리고 아래와 같이 limeinclude하고
  1. lime = require("lime.lime")
Note: the lime variable should be global as you see here, not local.
Now load up your map data:
위에서 저장한 맵데이터도 해당 폴더로 복사한뒤 아래와 같이 코딩을 합니다.
  1. local map = lime.loadMap("tutorial0.tmx")

After loading up your map you will not have any visual objects created, this allows you to load up multiple maps at once yet only creating the visual data later one at a time, to actually create the visual representation simply use the next line of code:
마지막으로 아래와 같이 하면 맵이 화면에 나타납니다.
  1. local visual = lime.createVisual(map)

Complete
Please remember to update your orientation settings in your build.settings file as this map has been designed for landscape screens.

Step 7: Bask in your awesomeness

Congratulations, you just made your first iPhone capable tile map! Does it give you a warm and fuzzy feeling inside? No? Then check out the second tutorial to add a bit more excitement to your map.


타일셋다운로드:http://lime.outlawgametools.com/tutorials/0/resources/tileset-platformer.png


꼭 알아두세요.
1. lime은 프로젝트 최상위 폴더에 lime폴더 통째로 복사해서 넣습니다.


댓글 없음:

댓글 쓰기