Skip to content

Commit 5c2f4e2

Browse files
committed
updating readme for release
1 parent 7be88b6 commit 5c2f4e2

8 files changed

+67
-25
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
src/graph/button/toolButtonSelect.png
2-
src/graph/button/toolButtonTileSwapper.png
2+
src/graph/button/toolButtonTileSwapper.png
3+
Boon.toml
4+
release

LICENSE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
The following license does not apply to the assets in src/graph/button/ they come from a pixel art editor that I DON'T own. You can get the editor at https://pyxeledit.com/
1+
The following license does not apply to the assets in src/graph/button/
2+
directory they are inspired from a pixel art editor that I DON'T own. You can
3+
get the editor at https://pyxeledit.com/
24

35
MIT License
46

README.md

Lines changed: 58 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
# 2DMapEditor
22

33
A minimalist 2D map editor.
4+
45
Create single layer 2D maps from a .png tileset.
6+
57
Export maps to txt, json, lua format.
68

9+
Made with [love2d](https://love2d.org/).
10+
711
## Preview
8-
img
12+
13+
![preview](img/preview.png)
14+
15+
Tileset from https://ansimuz.itch.io/grotto-escape-game-art-pack
916

1017
## Features
1118

@@ -41,52 +48,83 @@ This minimalist software does not provide any integrated tips or documentation,
4148

4249
### Get started
4350

51+
- Linux/MacOS install [love2d v11](https://love2d.org).
4452
- Download the map editor.
4553
- Unzip it.
4654
- Add at least one tileset in the tileset/ directory.
4755
- Edit the "editor.txt" file next to the map editor and change some settings to fit your need.
48-
- Run the map editor.
56+
- Run the map editor (on Linux/MacOS either double click on the .love file or use `$ love 2d_map_editor.love` from the command prompt).
4957
- Create a map.
5058
- Export your map.
5159
- Your exported map should now appear in the map/ directory.
5260

5361
### Shortcuts
5462

55-
- Draw: d
56-
- Erase: e
57-
- Fill: f
58-
- Tile picker: alt
59-
- Move:
60-
- arrow
61-
- space (keep pressed until done) + mouse left
62-
- Zoom: scroll
63+
| Keys | Description |
64+
|--- |---
65+
| <kbd>D</kbd> | Draw |
66+
| <kbd>E</kbd> | Erase |
67+
| <kbd>F</kbd> | Fill |
68+
| <kbd>Alt</kbd> | Tile picker |
69+
| Mouse Right | Tile picker |
70+
| <kbd>←</kbd><kbd>↑</kbd><kbd>→</kbd><kbd>↓</kbd> | Move |
71+
| <kbd>Spacebar</kbd> + Mouse Left | Move |
72+
| Mouse Wheel | Zoom |
6373

6474
---
6575

6676
## Input/Output Format
6777

68-
A 2d map is encoded as a 2d array of numbers. Each number matches a tileset tile.
78+
A 2d map is encoded as a 2d array of numbers. Each number matches a tile from the tileset.
79+
80+
Considering the following tileset:
81+
82+
![tileset to numbers](img/tileset_to_numbers.png)
6983

70-
tileset\_to\_number\_img
84+
And this 2d array of number:
85+
86+
```lua
87+
{
88+
{19, 19, 1, 4, 19},
89+
{21, 19, 9, 19, 19},
90+
{19, 19, 19, 19, 19},
91+
{16, 16, 6, 15, 16},
92+
{13, 13, 13, 13, 13}
93+
}
94+
```
95+
96+
We get the following map:
97+
98+
![numbers_to_map](img/numbers_to_map.png)
7199

72-
txt\_img
73-
json\_img
74-
lua\_img
75100

76101
## Importing a Map to Your Project
77102

78103
### With Lua (5.1)
79104

80-
If your using the lua programming language you can use this piece of code(TODO link) to parse it (lua 5.1 is used for the project, it may not work with other version).
105+
If your using the lua programming language, just require the map in your project:
106+
```lua
107+
local map = require("path/to/my/map")
108+
```
81109

82110
### Without Lua
83111

84-
Find a parser corresponding to the file format you want your map to be into, or create one (you can use this code(TODO link) as an example)
112+
Create/find a parser for the file format you want your map to be in.
85113

86114
---
87115

88116
## Project Status
89-
The project is currently almost finished, however feel free to open an issue if you encounter one. No features will be added.
90117

91-
## Why this project ?
92-
TODO
118+
The project is currently finished, however feel free to open an issue if you encounter one. No features will be added.
119+
120+
## Why this Project & more...
121+
122+
Initialy I wanted to be able to create maps for my 2d games, I tried [tiled](https://www.mapeditor.org/) but it's a big editor with tons of features and it was exporting maps in the json format, so I should have learned how to use the editor and use a library to parse json files.
123+
124+
Since I only needed single layers maps I started this little project.
125+
It was one of my first desktop application so it was very interesting on many points.
126+
127+
I created the map editor 2+ years ago but I never finished some features/polish but used it in multiple projects like [It Alive](https://mathurin.itch.io/italive). It's why I came back on it with the desire to make the initial idea come true.
128+
I find the project/code structure really bad now and that's a good thing, it means that my programming practices/skills have improved since.
129+
If I had to do it again now, I would do it in a much different maner.
130+
Thanks for reading.

editor.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ map/map
33
- TileSet path (with file extention) -
44
tileset/tileset.png
55
- TileSet tile width (px) -
6-
32
6+
16
77
- TileSet tile height (px) -
8-
32
8+
16
99
- Map width -
1010
40
1111
- Map height -

img/numbers_to_map.png

3.27 KB
Loading

img/preview.png

26.3 KB
Loading

img/tileset_to_numbers.png

8.43 KB
Loading

src/grid.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ grid.tileSetPath = "tileset/tileset.png"
99

1010
function grid.loadExternalImage()
1111
local path = love.filesystem.getSourceBaseDirectory().."/"..grid.tileSetPath
12-
local file = io.open(path, "r")
12+
local file = io.open(path, "rb")
1313
local data = file:read("*all")
1414
file:close()
1515
local fileData = love.filesystem.newFileData(data, "tileset")

0 commit comments

Comments
 (0)