README.md
December 6, 2024 ยท View on GitHub
NeLua-Platformer
Tutorial: Writing a 2D Platform Game in NeLua language with SDL2.
This repository has been inherited from Nim-Platformer and LuaJIT-Platformer project.
- Document
English: https://hookrace.net/blog/writing-a-2d-platform-game-in-nim-with-sdl2/
Japanese: https://postd.cc/writing-a-2d-platform-game-in-nim-with-sdl2/
Skin database https://ddnet.org/skins

Support OS
Windows10 or later
Prerequisites
-
Install MSys2/MinGW
-
Install NeLua
-
Install SDL2 libraries
pacman -S mingw-w64-x86_64-{SDL2,SDL2_image,SDL2_ttf}or if you use
ucrtlibraries,pacman -S mingw-w64-ucrt-x86_64-{SDL2,SDL2_image,SDL2_ttf}
-
Other tools
pacman -S makeGit command installed
Run tutorials
-
Clone from git
git clone https://github.com/dinau/nelua-platformer -
Build and run
cd nelua-paltformer cd tutorial make 8r # Build and run platformer_part8.neluaor enable runtime checking and debug build and run
pwd tutorial nelua paltformer_part8.nelua -
Only build a source
pwd tutorial make 8 # Build platformer_part8.nelua -
Build all tutorial sources
pwd tutorial make build # Build from part1 to part8 sources
Key operation
| Key | Function |
|---|---|
| Up,Space, J, K | Jump |
| Left, A, H | Left |
| Right, D, L | Right |
| R | Restart |
| Q | Quit |
Tutorial sources
platformer_part1.nelua
platformer_part2.nelua
platformer_part3.nelua
platformer_part4.nelua
platformer_part5.nelua : From here it can move the item with key operation.
platformer_part6.nelua
platformer_part7.nelua
platformer_part8.nelua
platformer_part9.nelua : In progress. TODO
Other SDL2 headers for Nelua
These header files
sdl2.nelua
sdl2_image.nelua
sdl2_ttf.nelua
have thankfully been just copied form nelua-decl libraries project.
Tools version
- Nelua 0.2.0-dev
- gcc.exe (Rev2, Built by MSYS2 project) 14.2.0
- SDL2 v2.30.9
- SDL2_image v2.8.2
- SDL2_ttf v2.22.0
Reference
- SDL2.dll https://github.com/libsdl-org/SDL/releases/
- SDL2_image.dll https://github.com/libsdl-org/SDL_image/releases/
- SDL2_ttf.dll https://github.com/libsdl-org/SDL_ttf/releases/
- LuaJIT-SDL2 https://github.com/sonoro1234/LuaJIT-SDL2
Other SDL game tutorial platfromer project

| Language | Project | |
|---|---|---|
| Nim | Compiler | Nim-Platformer / sdl3_nim |
| LuaJIT | Script | LuaJIT-Platformer |
| Nelua | Compiler | NeLua-Platformer |
Other project
| Language | Project | |
|---|---|---|
| Nim | Compiler | ImGuin, Nimgl_test, Nim_implot |
| Lua | Script | LuaJITImGui |
| Zig, C lang. | Compiler | Dear_Bindings_Build |
| Zig | Compiler | ImGuinZ |
| NeLua | Compiler | NeLuaImGui |
| Python | Script | DearPyGui for 32bit WindowsOS Binary |