This repository has been archived on 2022-12-05. You can view files and clone it, but cannot push or open issues or pull requests.
GeometryDash3D/js/main.js

33 lines
705 B
JavaScript
Raw Normal View History

import { Env } from "./Env.js";
2022-11-22 10:40:56 +01:00
import { Plane } from "./Plane.js";
import { Joueur } from "./player.js";
2022-11-07 09:10:20 +01:00
window.addEventListener("load", () => main());
const main = () => {
const env = new Env();
2022-11-07 09:59:36 +01:00
document.body.appendChild(env.getDomElement());
2022-11-08 09:43:37 +01:00
2022-11-22 10:40:56 +01:00
const plan = new Plane(
window.innerWidth / 50,
10,
THREE.Color.NAMES.white,
THREE.Color.NAMES.black
);
env.addToScene(plan);
2022-11-08 09:43:37 +01:00
const joueur = new Joueur(THREE.Color.NAMES.red);
env.addToScene(joueur);
addEventListener("keypress", joueur.controlUser);
2022-11-08 09:43:37 +01:00
const animate = () => {
requestAnimationFrame(animate);
env.animate();
env.render();
};
2022-11-08 09:43:37 +01:00
animate();
2022-11-07 09:10:20 +01:00
};