Tile Based Game<br />With cocos2d<br />
New Project<br />Xcode<br />FileNew Project- template for a cocos2d Application<br />새 프로젝트 시작하기<br />
Resources<br />A sprite / 캐릭터<br />Use for our player object <br />http://www.raywenderlich.com/downloads/Player.png<br />...
Making a Map with Tiled<br />Tiled Map Editor / 타일 맵 에디터<br />Java / Qt<br />Orientation / 종류<br />Orthogonal – the Legend...
20*15 (32*32)<br />
Add the tile set “New Tileset”<br />Get the image<br />Browser / navigate folder<br />Pick “desert_spacing”.png<br />Term<...
desert_spacing”.png<br />TileSet<br />
Drawing<br />Click “stamp” icon in toolbar<br />Click anywhere on the map you’d like to place to tile<br />도장 <br />원하는 곳에...
Zoom / Layer<br />Paint button – entire background<br />Zoom in/out<br />Layer name change <br />Layer 1 (double click ) -...
Load Tile to Cocos2D scene<br />HelloWorldScene.h / HelloWorldScene.m<br />
Object Layer / Properties<br />
Object Layer<br />// Inside the init method, after setting self.background<br />CCTMXObjectGroup*objects =[_tileMapobjectG...
Load Player <br />Add Player<br />CCSprite *_player;<br />// Right after the implementation section<br />@synthesize playe...
Upcoming SlideShare
Loading in …5
×

0413 tile based game

900 views
847 views

Published on

cocos2d / make tilemap / use tilemap

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
900
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

0413 tile based game

  1. 1. Tile Based Game<br />With cocos2d<br />
  2. 2. New Project<br />Xcode<br />FileNew Project- template for a cocos2d Application<br />새 프로젝트 시작하기<br />
  3. 3. Resources<br />A sprite / 캐릭터<br />Use for our player object <br />http://www.raywenderlich.com/downloads/Player.png<br />Some sound effects / 이펙트<br />With the excellent cxfr utility<br />http://thirdcog.eu/apps/cfxr<br />8-bit video game sounds / random sound generates<br />Some background music / 배경음<br />Garage band<br />Tile Set / 타일 맵<br />Map editor<br />http://www.mapeditor.org/<br />TMX format<br />
  4. 4. Making a Map with Tiled<br />Tiled Map Editor / 타일 맵 에디터<br />Java / Qt<br />Orientation / 종류<br />Orthogonal – the Legend of Zelda / 직교<br />Isometric – Disgaea / 격자<br />Map size / Tile size<br />맵사이즈<br />가로 타일개수 * 세로 타일 개수<br />타일 사이즈<br />가로 사이즈 * 세로 사이즈<br />
  5. 5. 20*15 (32*32)<br />
  6. 6. Add the tile set “New Tileset”<br />Get the image<br />Browser / navigate folder<br />Pick “desert_spacing”.png<br />Term<br />Margin <br />How many pixels Tiled should skipfor current tile before it starts lookingfor actual tile pixels.<br />Spacing<br />How many pixels Tiled should advanceafter it reads the actual tile pixels to get to the next tile data.<br />
  7. 7. desert_spacing”.png<br />TileSet<br />
  8. 8. Drawing<br />Click “stamp” icon in toolbar<br />Click anywhere on the map you’d like to place to tile<br />도장 <br />원하는 곳에 타일 클릭<br />
  9. 9. Zoom / Layer<br />Paint button – entire background<br />Zoom in/out<br />Layer name change <br />Layer 1 (double click ) -> Background<br />Save tile map<br />“Tilemap.tmx” <br />
  10. 10. Load Tile to Cocos2D scene<br />HelloWorldScene.h / HelloWorldScene.m<br />
  11. 11. Object Layer / Properties<br />
  12. 12. Object Layer<br />// Inside the init method, after setting self.background<br />CCTMXObjectGroup*objects =[_tileMapobjectGroupNamed:@"Objects"]; <br />NSAssert(objects !=nil, @"'Objects' object group not found"); <br />NSMutableDictionary*spawnPoint=[objects objectNamed:@"SpawnPoint"]; <br />NSAssert(spawnPoint!=nil, @"SpawnPoint object not found"); <br />int x =[[spawnPointvalueForKey:@"x"]intValue]; <br />int y =[[spawnPointvalueForKey:@"y"]intValue];   <br />self.player=[CCSpritespriteWithFile:@"Player.png"];<br /> _player.position=ccp(x, y); <br />[self addChild:_player];   <br />[self setViewpointCenter:_player.position];<br />
  13. 13. Load Player <br />Add Player<br />CCSprite *_player;<br />// Right after the implementation section<br />@synthesize player = _player;<br />  <br />// In dealloc<br />self.player=nil;   <br />

×