3D Game Programming
Ramp.prototype.rotate =function(angle) { this.mesh.rotation.z = this.mesh.rotation.z + angle; this.mesh.__dirtyRotation = true; ...
If you click and drag the ramps with your mouse, you’ll see that you can move them all over the game area. If you click and pres ...
We’re doing just about everything there is to do with Scoreboard.js here. Most of these are simple directions for how the scoreb ...
18.6 The Code So Far In case you would like to double-check the code in this chapter, it’s included in Section A1.18, Code: Cave ...
CHAPTER 19 Project: Multilevel Game Once you get the hang of playing the cave-puzzle game we coded in Chapter 18, Project: Cave ...
We make a copy because we have a good, working game that took us a while to write. We can always delete it later if this game tu ...
Another way to handle moving between levels is to remove and create specific game elements—like platforms and obstacles—while th ...
This method will take a list of things that belong to a new level. That list will include everything that needs to be shown when ...
Now comes the interesting work that Levels does. It needs to be able to level up when the player clears a level. As long as ther ...
varmaterial = Physijs.createMaterial( newTHREE.MeshBasicMaterial({color:0x333333}), 0.2, 1.0 ); varobstacle =newPhysijs.ConvexMe ...
The following will move the goal (after a 2-second delay): functionmoveGoal() { scene.remove(goal); setTimeout(placeGoal, 2*1000 ...
goal, and play the guitar when we reach the goal. Add the following just below your avatar.addEventListener() and before moveGoa ...
CHAPTER 20 Project: River Rafting For our final project, let’s build a river-rafting game in which the player needs to navigate ...
After the tag, let’s change the gravity from -100 to -20: scene.setGravity(newTHREE.Vector3( 0, -20, 0 )); You can experiment w ...
Adding Sunlight Our raft is going to be making jumps and bumping into things. This will be more fun if there are shadows. For sh ...
We could have used 1 for each of the numbers and the effect would be the same. The sun would still be shining down from the same ...
functionaddScoreboard() { varscoreboard =newScoreboard(); scoreboard.score(0); scoreboard.timer(); scoreboard.help( 'left / righ ...
functionaddRiver(scene) { varground = makeGround(500); addWater(ground, 500); addLid(ground, 500); scene.add(ground); returngrou ...
This will produce a flat, green plane. (As always, you don’t need to type in the comments that are in the code, though later the ...
Then we add the following points after the ground’s shadow properties: ground.river_points = river_points; The entire makeGround ...
«
5
6
7
8
9
10
11
12
13
14
»
Free download pdf