Skip to content

Commit

Permalink
Levelmaker instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
FLAK-ZOSO committed Jun 24, 2023
1 parent ba8acfe commit d3e2f93
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
64 changes: 64 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ fullkning.exe <level-number>

## Create your own level

### Manually

You can create your own level by creating a `<level-number>.level` file with the following format...

```txt
Expand Down Expand Up @@ -63,3 +65,65 @@ For each coordinate you will have a `VirtualBlock` which is your cyan `O` target
```

For example this is the level 4.

### With level editor

#### Windows

Since `v0.2.0`, you can create your own level with the level editor by running the following command...

```batch
levelmaker.exe <level-name>
```

...you will see a window like this...

```batch
&&&&&&&&&&&&
& &
& $ &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
& &
&&&&&&&&&&&&
Use {W, A, S, D}+ENTER to move the cursor
Use {P, R}+ENTER to place and remove a block
Use {Q}+ENTER to quit
```

...and you can create your own level by moving the cursor with `W`, `A`, `S`, `D` and placing or removing a block with `P` and `R`.

ℹ️ - The blocks are placed under the `$` character if possible

Then you can save your level by pressing `Q` and the level will be saved in the `levels` folder.

#### Others

You can create your own level with the level editor by running the following command...

```bash
g++ levelmaker.cpp -o levelmaker -std=c++17
./levelmaker <level-name>
```

...you will see a window like the one above, now you can create your own level by moving the cursor with `W`, `A`, `S`, `D` and placing or removing a block with `P` and `R`.

ℹ️ - The blocks are placed under the `$` character if possible
⚠️ - Due to problems with raw input, you will have to press `ENTER` after each key press

Then you can save your level by pressing `Q` and the level will be saved in the `levels` folder.
14 changes: 12 additions & 2 deletions levelmaker.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "include/sista/sista.hpp"
#include <iostream>
#include <fstream>
#ifdef _WIN32
#include <conio.h>
#endif

#define WIDTH 10
#define HEIGHT 20
Expand Down Expand Up @@ -43,8 +46,15 @@ int main(int argc, char* argv[]) {
std::cout << "Use {Q}+ENTER to quit" << std::endl;

while (true) {
cursor_handler.set({30, 30});
char input = std::cin.get();
#ifdef _WIN32
char input = getch();
#elif __APPLE__
cursor_handler.set({20, 30});
char input = std::cin.get();
#else
cursor_handler.set({20, 30});
char input = std::cin.get();
#endif
switch (input) {
case 'w': case 'W':
if (builder->getCoordinates().y > 0) {
Expand Down
Binary file modified levelmaker.exe
Binary file not shown.

0 comments on commit d3e2f93

Please sign in to comment.