layout changed

This commit is contained in:
Freya Murphy 2023-06-17 01:34:20 -04:00
parent a4a968c408
commit fa2d9b6f91
6 changed files with 16 additions and 7 deletions

View file

@ -23,6 +23,11 @@ body {
align-items: center; align-items: center;
justify-content: center; justify-content: center;
position: absolute; position: absolute;
flex-direction: column;
}
#mapeditor {
margin-top: 2rem;
} }
.rotate90 { .rotate90 {

View file

@ -14,7 +14,8 @@
<input type="text" id="player_name" name="name" placeholder="Player Name"> <input type="text" id="player_name" name="name" placeholder="Player Name">
<input type="submit" value="Join!"/> <input type="submit" value="Join!"/>
</form> </form>
<div id="lobby"> <input id="mapeditor" type="button" value="Map Editor">
<div id="lobby" style="display: none;">
<span>Players:</span> <span>Players:</span>
<div id="players"></div> <div id="players"></div>
<input type="button" id="start" value="Start Game"/> <input type="button" id="start" value="Start Game"/>

View file

@ -16,7 +16,7 @@
<input type="submit" value="Create"/> <input type="submit" value="Create"/>
</form> </form>
</div> </div>
<div id="sidebar"> <div id="sidebar" style="display: none;">
<p>W: Place Wall</p> <p>W: Place Wall</p>
<p>G: Place Ghost Wall</p> <p>G: Place Ghost Wall</p>
<p>F: Place Food</p> <p>F: Place Food</p>

View file

@ -1,10 +1,9 @@
import { genMap } from "./map.js" import { genMap } from "./map.js"
import { startGraphicsUpdater } from "./renderer.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 mapgen = document.getElementById("mapgen")
const sidebar = document.getElementById("sidebar") const sidebar = document.getElementById("sidebar")
sidebar.style.display = "none"
mapgen.onsubmit = async function(event) { mapgen.onsubmit = async function(event) {
event.preventDefault() event.preventDefault()

View file

@ -5,7 +5,7 @@ import { GameKeyMap, Frame, Key } from "./types.js";
const join = document.getElementById("join") const join = document.getElementById("join")
const lobby = document.getElementById("lobby") const lobby = document.getElementById("lobby")
lobby.style.display = "none" const mapeditor = document.getElementById("mapeditor")
join.onsubmit = async function(event) { join.onsubmit = async function(event) {
event.preventDefault() event.preventDefault()
@ -24,10 +24,15 @@ join.onsubmit = async function(event) {
} }
join.style.display = "none" join.style.display = "none"
mapeditor.style.display = "none"
startGame(room_code, player_name) startGame(room_code, player_name)
} }
mapeditor.onclick = function() {
window.location.href = 'mapeditor.html'
}
const updateGraphics = startGraphicsUpdater() const updateGraphics = startGraphicsUpdater()
const onLoad = (startData: Frame) => { const onLoad = (startData: Frame) => {

View file

@ -179,8 +179,7 @@ export function multiplayer(
} }
if (!flushCachedInputs(delta / 2)) { if (!flushCachedInputs(delta / 2)) {
socket.close() socket.close()
document.getElementById("lobby").style.display = "none" window.location.reload()
document.getElementById("join").style.display = ""
return return
} }
} }