2022-12-02 16:32:52 +01:00
|
|
|
import { runGame } from "./Game.js";
|
2022-11-08 10:40:45 +01:00
|
|
|
|
2022-11-07 09:10:20 +01:00
|
|
|
window.addEventListener("load", () => main());
|
|
|
|
|
2022-12-02 16:32:52 +01:00
|
|
|
/**
|
|
|
|
* Load the menu
|
|
|
|
*/
|
2022-11-07 09:10:20 +01:00
|
|
|
const main = () => {
|
2022-12-02 16:32:52 +01:00
|
|
|
document.body.style = "background-color: black;";
|
2022-11-08 09:43:37 +01:00
|
|
|
|
2022-12-02 16:32:52 +01:00
|
|
|
let titleGame = document.createElement("p");
|
|
|
|
titleGame.textContent = "GeometryDash 3D";
|
|
|
|
titleGame.style =
|
2022-12-02 22:46:22 +01:00
|
|
|
"-webkit-animation-name: animTitle; \
|
|
|
|
-webkit-animation-iteration-count: infinite; \
|
|
|
|
-webkit-animation-duration: 2s; \
|
|
|
|
background: none; \
|
2022-12-02 16:32:52 +01:00
|
|
|
color: white; \
|
|
|
|
font-size: 400%;";
|
|
|
|
document.body.appendChild(titleGame);
|
2022-11-24 19:45:20 +01:00
|
|
|
|
2022-12-02 16:32:52 +01:00
|
|
|
let normalGame = document.createElement("button");
|
|
|
|
normalGame.textContent = "Partie normale";
|
|
|
|
normalGame.style =
|
2022-12-02 22:46:22 +01:00
|
|
|
"margin-top: 20%; \
|
2022-12-02 16:32:52 +01:00
|
|
|
border: none; \
|
|
|
|
background: none; \
|
2022-11-24 21:33:38 +01:00
|
|
|
color: white; \
|
2022-12-02 22:46:22 +01:00
|
|
|
font-size: 400%; \
|
|
|
|
cursor: pointer;";
|
2022-12-02 16:32:52 +01:00
|
|
|
document.body.appendChild(normalGame);
|
2022-12-02 00:15:37 +01:00
|
|
|
|
2022-12-02 16:32:52 +01:00
|
|
|
let demoGame = document.createElement("button");
|
|
|
|
demoGame.textContent = "Partie démo";
|
|
|
|
demoGame.style =
|
|
|
|
"position: absolute; \
|
|
|
|
top: 40%; \
|
|
|
|
left: 37%; \
|
|
|
|
border: none; \
|
|
|
|
background: none; \
|
|
|
|
color: white; \
|
2022-12-02 22:46:22 +01:00
|
|
|
font-size: 400%; \
|
|
|
|
cursor: pointer;";
|
2022-12-02 16:32:52 +01:00
|
|
|
document.body.appendChild(demoGame);
|
2022-11-24 21:33:38 +01:00
|
|
|
|
2022-12-02 16:32:52 +01:00
|
|
|
const removeMenu = () => {
|
|
|
|
document.body.removeChild(titleGame);
|
|
|
|
document.body.removeChild(normalGame);
|
|
|
|
document.body.removeChild(demoGame);
|
2022-11-08 10:40:45 +01:00
|
|
|
};
|
2022-11-08 09:43:37 +01:00
|
|
|
|
2022-12-02 16:32:52 +01:00
|
|
|
normalGame.addEventListener(
|
|
|
|
"click",
|
|
|
|
() => {
|
|
|
|
removeMenu();
|
|
|
|
runGame(false);
|
|
|
|
},
|
|
|
|
{ once: true }
|
|
|
|
);
|
|
|
|
|
|
|
|
demoGame.addEventListener(
|
|
|
|
"click",
|
|
|
|
() => {
|
|
|
|
removeMenu();
|
|
|
|
runGame(true);
|
|
|
|
},
|
|
|
|
{ once: true }
|
|
|
|
);
|
2022-11-07 09:10:20 +01:00
|
|
|
};
|