Seta:Gpu Mini - Honguito98/Seta-Engine-for-Batch-games GitHub Wiki
The most basic game engine almost ready to use.
Features:
- Easy to program
- Basic collision detection
- Custom color per line
- Basic load/save state
Has some drawbacks:
- Slow rendering
- Does not work on Windows XP
- Limimted char variety
- Limited colors
- Limited keyboard keystroke detection: no special keys like arrow keys, F# Keys, just alphanumeric keys.
Programing
Programing is done by modifiying the engine itself. The source code have comments about it is functionality. So, download and edit your copy of Seta:Gpu Mini!
Changing screen layout
You can add nice player status by adding a small piece of code. First you will need to locate the text:
%== Screen Rendering ==% Set Key=&Cls For /F "Tokens=1-2" %%x in ("!XMin! !XMax!") Do ( For /L %%a in (!YMin!,1,!YMax_!) Do ( Findstr /A:!C[%%a]! "." "!L[%%a]:~%%x,%%y!?\..\Tmp" ) ) Echo;Coins: !Coins!
In this case, will show 'coins: #' below of our level content. If you want that this text appears on top the level, swap the Echo;Coins: !Coins! line to the For.
For example:
%== Screen Rendering ==% Set Key=&Cls Echo;Lives: !Lives! Score: !Score! Coins: !Coins! Level: !Level! For /F "Tokens=1-2" %%x in ("!XMin! !XMax!") Do ( For /L %%a in (!YMin!,1,!YMax_!) Do ( Findstr /A:!C[%%a]! "." "!L[%%a]:~%%x,%%y!?\..\Tmp" ) )
Changing keystroke behavior
Here you can change what action will do a specific keystroke. Remeber that alphanumeric character, BackSpace(BS) and CarriageReturn(CR or Enter key) are supported.
%== KeyBoard Support ==% For /F "Delims=" %%K In ('Xcopy /W "%~f0" "%~f0" 2^>Nul') Do ( If Not Defined Key ( Set "Key=%%K" set "key=!Key:~-1!" ) ) If /i "!Key!" Equ "a" Set Player.Dir=H - If /i "!Key!" Equ "d" Set Player.Dir=H + If /i "!Key!" Equ "w" Set Player.Dir=V - If /i "!Key!" Equ "s" Set Player.Dir=V + If "!Key!" Equ "!BS!" Goto :Menu If "!Key!" Equ "!CR!" ( %== Enter Key ==% Call :Pause )
Changing collision behavior
The Err variable specifies if X object has collided with Y.
Value | Description |
---|---|
-1 | Undefined |
0 | No collision |
1 | Collide (stop step forward) |
The %%3 variable indicates the owner of event i.e the entity that displaced to another location. While the !Chr! variable holds the 'object type' (a wall, coin, enemy, etc). To 'pick up' a character you may want to remove it by setting the Chr variable to, for example, ground character.
%== Put Here The Conditions ==% %== Follow The Example ==% %== If is Player Then... If Your Next Step It's a Block Do Nothing==% If !Err! Equ -1 ( If /i "%%3" Equ "Player" ( If "!Chr!" Equ "%Border%" Set Err=1 If "!Chr!" Equ "%Floor%" Set Err=1 If "!Chr!" Equ "%Floor2%" Set Err=1 If "!Chr!" Equ "%Coin%" ( Set/a Coins+=1 %== Remove The Sprite Coin ==% Set "Chr=%Ground%" Set/p=%Beep%<Nul ) If !Err! Neq 1 If "!Chr!" Equ "%Exit%" Set End=Win ) )