Session 4

Creating a tile-based editor for a platform game
(Grids, check buttons, WinExec, handling draw events)

Session #4

The session dealt with implementing a tile-based editor for a platform game. The platform game was actually from a CS230 course at Digipen. This is a screen shot of that game:

The game in actionThe data file used
Width 20
Height 20
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
1 0 4 3 0 0 0 0 0 4 0 3 0 0 1 1 1 1 1 1 
1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 
1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 
1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 2 0 1 1 1 
1 0 0 0 4 0 0 0 3 0 0 0 0 0 0 0 0 0 1 1 
1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 
1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 
1 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 
1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 
1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 
1 0 0 0 1 1 0 0 1 1 1 1 1 1 1 0 1 1 1 1 
1 0 0 0 0 1 0 0 0 3 4 0 0 4 0 0 0 4 0 1 
1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 
1 0 4 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 
1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 
1 0 0 1 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 1 
1 0 0 0 3 4 0 0 0 0 0 0 4 0 0 0 0 0 0 1 
1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 

This tool is by no means complete, but it is a good starting point. The primary focus of this lecture was to introduce the drawing grid components (TDrawGrid and TStringGrid). These components are very powerful and can bring a lot of power with minimal cost.

This is a very small program that just demonstrates some of the properties of the TDrawGrid and TStringGrid components. You should look at the properties in the Object Inspector in the IDE. Modify some of them and see how it changes the behavior. Specifically, modify these properties:

The draw gridThe string grid


This is the "platform editor" that was presented during the session:

The empty editorThe completed "level"


Be sure to read the comments in the .cpp file. They should explain most of what is going on.