I created a video of a very simple 2D tilemap game running on the desktop and an Android phone. The video focuses on creating a json map file. The video will take you through step four of the process listed below:
- Assemble tilesets which are pictures of grass, trees, water, rocks, bushes, houses and other graphics in the game;
- Assemble other sprites for graphics such as the character running around the screen;
- Create map data file using the Tiled map editor;
- Export the file to JSON format;
- Create a map loader in python;
- Use pygame to display graphics and handle player interaction;
- Use Pygame Subset for Android to package the Python application in Android Package format
I didn't cover how to write the map loader in this video since that video may take a long time. The loader itself is less than a 100 lines of code. The data structures are a bit more complex since Python loads the json file into the Python program as a nested dictionary structure.
Update Dec 2013: Check out the code for an improved json_loader on github.
Update December 13, 2013
Wrote a new blog post on using json_loader with examples of different types of games.
Update Dec 2013: Check out the code for an improved json_loader on github.
Sample game running with 2d map showing collision tiles shaded red. Code and graphic files available on github |
2nd layer of collision tiles separated out of the 3 layer map by test scripts in the game example. Sample map included in the github package, available at the link above. |
Wrote a new blog post on using json_loader with examples of different types of games.
No comments:
Post a Comment