This editor lets you edit tiles, tile maps and tile codes.
How do you install the PGU tilemap editor ?
- Mac OS/X 10.5 already has python 2.5 installed, but you need to install MacPython (the pygame installer needs it): python-2.5-macosx.dmg
- Once you have installed MacPython, you need to install pygame: pygame-1.8.1release-py2.5-macosx10.5.zip
- And once you have installed pygame, install pyobjc-1.4: http://www.pygame.org/ftp/pyobjc-1.4-py2.5-macosx10.4.mpkg.zip
- And then you can download and uncompress the PGU level editor: pgu_level_editor-20081118.tar.gz (This is the standard PGU dist + cocos2d examples)
home:~ $ cd src/pgu_level_editor
home:~/src/pgu_level_editor $ python leveledit.py level.tga
The left panel is the map.The upper-right panel are the tiles.
The bottom-right panel are the codes.
The map is loaded from the file: level.tga
The tiles are loaded from the file: tiles.tga
The codes are loaded from the file: codes.tga
For more info see the leveledit.ini file. eg: you can change the tiles' size.
Features and limitations:
- cocos2d v0.6.1 (an earlier) doesn't support codes, so ignore this feature for the moment.
- PGU tile editor uses the TGA RGB channels to identify the codes, tiles' positions and (mmm... what else? I'm not sure). So, you can only have 256 different tiles per TileMap.
How to use these files from cocos2d for iPhone:
- Include the tiles.png and level.tga to your XCode project
- See the AtlasDemo example: TestAtlas.m. In particular see the Atlas3 demo.
-(id) init
{
if( ![super init] )
return nil;
TileMapAtlas *tilemap = [TileMapAtlas tileMapAtlasWithTileFile:@"tiles.png" mapFile:@"level.tga" tileWidth:16 tileHeight:16];
[self add:tilemap];
return self;
}
Update: Added missing pyobjc-1.4 package
14 comments:
Hi, I'm using Leopard, and went through the special install instructions for that, but am getting this error:
Traceback (most recent call last):
File "leveledit.py", line 71, in module
import pygame
ImportError: No module named pygame
any ideas?
Hi, I'm using Leopard, and went through the special install instructions for that, but am getting this error:
Traceback (most recent call last):
File "leveledit.py", line 71, in module
import pygame
ImportError: No module named pygame
any ideas?
It seems that pygame was not installed.
Mike, you are using another python, try this
$ /usr/local/bin/python leveledit.py level.tga
or find all pythons on your mac, and try them one by one.
$ where python
sorry for a stupid question where and how exactly am i supposed to type this?
:
home:~ $ cd src/pgu_level_editor
home:~/src/pgu_level_editor $ python leveledit.py level.tga
where can i find tutorials on using the editor?
thanks for the tutorial, worked great!!!
hii nice tutorial i m having problem using tiled map in my cocos2d application. i am using a palette and a map which has been included in the project but it is not being shown on the screen and their isnt any error as well.
@zeeler: could you describe the steps that your are doing ?
Please, post it here:
http://groups.google.com/group/cocos2d-iphone-discuss
i created a map using tiled-0.7.2 from where i save the map as .tga file and then i import the .tga file into my cocos2d project and the palette.png which i use for map creation. Then i create TileMapAtlas using the two files....
Is this the right way???
How do you specify the png file for codes, or is a separate code file not allowed/supported?
hello im sorry to ask this stupid question, but when it says how to run the editor, and lists code, where do i enter the commands?
dont use GPU. use java based instead
Zeeeler,
The layers in your tilemap must have specific names:
tile
code
bkgr
Make sure the tile one is the one with the visuals, otherwise it won't be recognized. I had the same problem, and renaming the layer fixed it.
hello, i've created the map and can load it on screen, the problem is i see it on screen as each tile drawing 4 little tiles from the map, and sizes are correct, 16x16 everywhere. any idea? thanks
Post a Comment