Maps, Collisions, and Items

I've made some significant progress since the last post to the tune of some 600 lines of code. A large pain point for this segment of functionality was figuring out how to read Lua scripts into the game engine and translate the script variables into something usable in C. What I've come up with works, though the implementation seems rather brittle. This may simply be a facet of trying to read any configuration in non-C into C, although admittedly interacting with the Lua stack is not the most intuitive of approaches...

Reading the Lua map scripts allowed me to be able to properly render a game screen and all of its collision bounds and items. I have yet to connect the maps via doors, but that's only a matter of time now. Below is a video of the progress as of right now.

One touch that I added was to offset the player sprite by -16 pixels on the Y axis. This allows it to be drawn halfway on top of other blocks to make it look as if he's walking in front of things and also not walking directly on the water's edge. However, this has presented a new issue where half of the player will be drawn off screen if he's walking in the top row of squares in the game window. You can't see this in the map segment shown in the video, but this becomes an issue in other map segments. I'll need to figure out what to do about that. I may just add a border around the entire playable area.

I may take a slight detour here soon and start working on a GUI map editor. Editing them by hand is going to get out of hand, so to speak, and I have some ideas about the machanics behind how to implement an editor. We'll see if I can make it work out or if it's going to become a miserable headache project. That being said, it may behoove me to move away from C to build it if I can accomplish the task faster in another language. If I can still easily use SDL, perhaps I can work with C# in .NET Core on Linux. I'll have to see what my options are, anyhow.

Also, I've added v0.02 to the game page. I don't have a working Windows build for this at the moment.

Code Stats

Language                     files          blank        comment           code
C                               12            176             82            919
C/C++ Header                    15             85             49            560
Lua                              2             12              0            219
Bourne Shell                     1              5              0             14
DOS Batch                        1              6              0             13
make                             1              0              0              3
SUM:                            32            284            131           1728