• Save
0413 tile based game
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
971
On Slideshare
971
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

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