Code: Das Lila-Obstmonster-Spiel

Dies ist die fertige Version des Spielcodes aus Kapitel 14, Projekt: Das Lila-Obstmonster-Spiel, auf Seite 171.

<body></body>

<script src="/three.js"></script>

<script src="/physi.js"></script>

<script src="/scoreboard.js"></script>

<script>

// Physics settings

Physijs.scripts.ammo = '/ammo.js';

Physijs.scripts.worker = '/physijs_worker.js';

// The "scene" is where stuff in our game will happen:

var scene = new Physijs.Scene();

scene.setGravity(new THREE.Vector3( 0, -250, 0 ));

var flat = {flatShading: true};

var light = new THREE.AmbientLight('white', 0.8);

scene.add(light);

// The "camera" is what sees the stuff:

var w = window.innerWidth / 2;

var h = window.innerHeight / 2;

var camera = new THREE.OrthographicCamera(-w, ...

Get Kids programmieren 3D-Spiele mit JavaScript, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.