more map data
This commit is contained in:
@@ -7,7 +7,8 @@ Data must be in a map.json file. `nodes` is an object with named arrays of info.
|
|||||||
Each node is an `x`, `y`, and `z` position. The optional 4th item is `true` to
|
Each node is an `x`, `y`, and `z` position. The optional 4th item is `true` to
|
||||||
display the node's name, a string to display *that* as the node name, or `false`
|
display the node's name, a string to display *that* as the node name, or `false`
|
||||||
to completely hide a node. `edges` is an array of arrays of two names of nodes.
|
to completely hide a node. `edges` is an array of arrays of two names of nodes.
|
||||||
An optional 3rd item can be set to `false` to hide an edge.
|
An optional 3rd item can be set to `false` to hide an edge, or a string for a
|
||||||
|
custom label.
|
||||||
|
|
||||||
- TODO: Make drag and drop loading of a JSON file possible. :D
|
- TODO: Make drag and drop loading of a JSON file possible. :D
|
||||||
- TODO: Make it not error with no map file.
|
- TODO: Make it not error with no map file.
|
||||||
|
|||||||
57
map.json
57
map.json
@@ -1,19 +1,50 @@
|
|||||||
{
|
{
|
||||||
"nodes": {
|
"nodes": {
|
||||||
"TestA": [100, 0, 100],
|
"Second Farm": [-260, 67, -263, true],
|
||||||
"TestB": [150, 0, 200],
|
"tree farm north": [-164, 71, -267, false],
|
||||||
"TestC": [300, 0, -200, true],
|
"Tree Farm": [-156, 68, -252, true],
|
||||||
"TestE": [1200, 0, 200, "Displayed Name"],
|
"farm paths diverge point": [-157, 71, -15, false],
|
||||||
"TestFarLeft": [-200, 5000, 50],
|
"First Farm": [-146, 74, 10, true],
|
||||||
"TestFarBottomRight": [1200, 0, 2000, true],
|
"1st water crossing / halfway point": [-51, 64, 24, false],
|
||||||
"Hidden Node": [0, 0, 0, false]
|
"1st path split": [0, 95, 36, false],
|
||||||
|
"Spawn Point": [0, 87, 0, "Spawn"],
|
||||||
|
"Warehouse/Mine": [84, 110, 76, true],
|
||||||
|
"to village curve point": [139, 105, 145, false],
|
||||||
|
"Cliffspawn Village Bridge": [130, 104, 255, false],
|
||||||
|
"Cliffspawn Village": [147, 96, 305, true],
|
||||||
|
"spawn hovel": [4, 91, -10, false],
|
||||||
|
"zombie spawner (hovel mine)": [96, 32, 26, "Zombie Dungeon"],
|
||||||
|
"geode (hovel mine)": [126, -37, -12, "geode"],
|
||||||
|
"future sand mine": [191, 63, -297, true],
|
||||||
|
"skeleton spawner (1st mine)": [119, 36, 92, true, "Skelton Dungeon"],
|
||||||
|
"Mount Sharpe": [696, 178, 667, true],
|
||||||
|
"Great Rock Waterfall": [814, 120, 601, true],
|
||||||
|
"Great Rock Waterfall (bottom)": [809, 74, 536, false],
|
||||||
|
"waterfall 2 top": [832, 121, 631, false],
|
||||||
|
"waterfall 2 bottom": [884, 82, 628, false],
|
||||||
|
"Ruined Nether Portal": [853, 79, 805, true],
|
||||||
|
"Trickster Waterfall": [439, 81, 743, true],
|
||||||
|
"Trickster Waterfall (bottom)": [441, 62, 730, false],
|
||||||
|
"village crossroad": [130, 101, 296, false, {"notes": "insignificant"}]
|
||||||
},
|
},
|
||||||
"edges": [
|
"edges": [
|
||||||
["TestA", "TestB"],
|
["tree farm north", "Second Farm"],
|
||||||
["TestA", "TestC"],
|
["tree farm north", "farm paths diverge point"],
|
||||||
["TestB", "TestC"],
|
["farm paths diverge point", "First Farm"],
|
||||||
["TestC", "TestE"],
|
["First Farm", "1st water crossing / halfway point"],
|
||||||
["TestE", "TestFarLeft"],
|
["1st water crossing / halfway point", "1st path split"],
|
||||||
["Hidden Node", "TestC", false]
|
["1st path split", "Spawn Point"],
|
||||||
|
["Spawn Point", "Warehouse/Mine"],
|
||||||
|
["Warehouse/Mine", "to village curve point"],
|
||||||
|
["to village curve point", "Cliffspawn Village Bridge"],
|
||||||
|
["Second Farm", "farm paths diverge point"],
|
||||||
|
["1st path split", "Warehouse/Mine", false, {"notes": "not real"}],
|
||||||
|
["Cliffspawn Village", "Cliffspawn Village Bridge"],
|
||||||
|
["spawn hovel", "geode (hovel mine)"],
|
||||||
|
["spawn hovel", "zombie spawner (hovel mine)"],
|
||||||
|
["Warehouse/Mine", "skeleton spawner (1st mine)", false],
|
||||||
|
["Great Rock Waterfall", "Great Rock Waterfall (bottom)"],
|
||||||
|
["waterfall 2 top", "waterfall 2 bottom"],
|
||||||
|
["Trickster Waterfall", "Trickster Waterfall (bottom)", ""]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/main.lua
12
src/main.lua
@@ -1,8 +1,9 @@
|
|||||||
local json = require "lib.dkjson"
|
local json = require "lib.dkjson"
|
||||||
|
|
||||||
|
love.window.setMode(1600, 900)
|
||||||
local screen_width, screen_height = love.graphics.getDimensions()
|
local screen_width, screen_height = love.graphics.getDimensions()
|
||||||
local node_radius = 5
|
local node_radius = 2
|
||||||
local safe_zone = 15
|
local safe_zone = 12
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -63,10 +64,13 @@ function love.draw()
|
|||||||
|
|
||||||
local center_x = node_a[1] + (node_b[1] - node_a[1]) / 2
|
local center_x = node_a[1] + (node_b[1] - node_a[1]) / 2
|
||||||
local center_z = node_a[3] + (node_b[3] - node_a[3]) / 2
|
local center_z = node_a[3] + (node_b[3] - node_a[3]) / 2
|
||||||
local distance = math.floor(math.sqrt((node_b[3] - node_a[3])^2 + (node_b[2] - node_a[2])^2 + (node_b[1] - node_a[1])^2))
|
local distance = math.floor(math.sqrt((node_b[3] - node_a[3])^2 + (node_b[2] - node_a[2])^2 + (node_b[1] - node_a[1])^2)) .. "m"
|
||||||
|
if type(edge[3]) == "string" then
|
||||||
|
distance = edge[3]
|
||||||
|
end
|
||||||
|
|
||||||
love.graphics.setColor(0.67, 0.67, 0.67, 1)
|
love.graphics.setColor(0.67, 0.67, 0.67, 1)
|
||||||
love.graphics.print(distance .. "m", center_x, center_z - font:getHeight() / 2, 0, 1 / scale, 1 / scale)
|
love.graphics.print(distance, center_x, center_z - font:getHeight() / 2, 0, 1 / scale, 1 / scale)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user