summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--client/css/main.css5
-rw-r--r--client/index.html3
-rw-r--r--client/mapeditor.html2
-rw-r--r--client/src/editor.ts3
-rw-r--r--client/src/main.ts7
-rw-r--r--client/src/net/multiplayer.ts3
6 files changed, 16 insertions, 7 deletions
diff --git a/client/css/main.css b/client/css/main.css
index f8309de..26fab00 100644
--- a/client/css/main.css
+++ b/client/css/main.css
@@ -23,6 +23,11 @@ body {
align-items: center;
justify-content: center;
position: absolute;
+ flex-direction: column;
+}
+
+#mapeditor {
+ margin-top: 2rem;
}
.rotate90 {
diff --git a/client/index.html b/client/index.html
index 4d19ec0..5e76fbc 100644
--- a/client/index.html
+++ b/client/index.html
@@ -14,7 +14,8 @@
<input type="text" id="player_name" name="name" placeholder="Player Name">
<input type="submit" value="Join!"/>
</form>
- <div id="lobby">
+ <input id="mapeditor" type="button" value="Map Editor">
+ <div id="lobby" style="display: none;">
<span>Players:</span>
<div id="players"></div>
<input type="button" id="start" value="Start Game"/>
diff --git a/client/mapeditor.html b/client/mapeditor.html
index 4fca9de..5df8c38 100644
--- a/client/mapeditor.html
+++ b/client/mapeditor.html
@@ -16,7 +16,7 @@
<input type="submit" value="Create"/>
</form>
</div>
- <div id="sidebar">
+ <div id="sidebar" style="display: none;">
<p>W: Place Wall</p>
<p>G: Place Ghost Wall</p>
<p>F: Place Food</p>
diff --git a/client/src/editor.ts b/client/src/editor.ts
index 687f076..77088ce 100644
--- a/client/src/editor.ts
+++ b/client/src/editor.ts
@@ -1,10 +1,9 @@
import { genMap } from "./map.js"
import { startGraphicsUpdater } from "./renderer.js"
-import { GameState, Vec2, ATLAS_TILE_WIDTH, Tile } from "./types.js"
+import { GameState, Vec2, Tile } from "./types.js"
const mapgen = document.getElementById("mapgen")
const sidebar = document.getElementById("sidebar")
-sidebar.style.display = "none"
mapgen.onsubmit = async function(event) {
event.preventDefault()
diff --git a/client/src/main.ts b/client/src/main.ts
index c8a1758..7ac13a3 100644
--- a/client/src/main.ts
+++ b/client/src/main.ts
@@ -5,7 +5,7 @@ import { GameKeyMap, Frame, Key } from "./types.js";
const join = document.getElementById("join")
const lobby = document.getElementById("lobby")
-lobby.style.display = "none"
+const mapeditor = document.getElementById("mapeditor")
join.onsubmit = async function(event) {
event.preventDefault()
@@ -24,10 +24,15 @@ join.onsubmit = async function(event) {
}
join.style.display = "none"
+ mapeditor.style.display = "none"
startGame(room_code, player_name)
}
+mapeditor.onclick = function() {
+ window.location.href = 'mapeditor.html'
+}
+
const updateGraphics = startGraphicsUpdater()
const onLoad = (startData: Frame) => {
diff --git a/client/src/net/multiplayer.ts b/client/src/net/multiplayer.ts
index 5dcf86d..12d1773 100644
--- a/client/src/net/multiplayer.ts
+++ b/client/src/net/multiplayer.ts
@@ -179,8 +179,7 @@ export function multiplayer(
}
if (!flushCachedInputs(delta / 2)) {
socket.close()
- document.getElementById("lobby").style.display = "none"
- document.getElementById("join").style.display = ""
+ window.location.reload()
return
}
}