32 lines
705 B
JavaScript
32 lines
705 B
JavaScript
import { Env } from "./Env.js";
|
|
import { Plane } from "./Plane.js";
|
|
import { Joueur } from "./player.js";
|
|
|
|
window.addEventListener("load", () => main());
|
|
|
|
const main = () => {
|
|
const env = new Env();
|
|
|
|
document.body.appendChild(env.getDomElement());
|
|
|
|
const plan = new Plane(
|
|
window.innerWidth / 50,
|
|
10,
|
|
THREE.Color.NAMES.white,
|
|
THREE.Color.NAMES.black
|
|
);
|
|
env.addToScene(plan);
|
|
|
|
const joueur = new Joueur(THREE.Color.NAMES.red);
|
|
env.addToScene(joueur);
|
|
|
|
addEventListener("keypress", joueur.controlUser);
|
|
|
|
const animate = () => {
|
|
requestAnimationFrame(animate);
|
|
env.animate();
|
|
env.render();
|
|
};
|
|
|
|
animate();
|
|
};
|