Adding Finishing Touches to the Game

This is already a pretty cool game, but we’ve positioned ourselves nicely for adding touches that can make it more unique and fun. The most obvious thing to do is add new levels. You can try the following (and possibly add a few of your own) after the first level and before the avatar.addEventListener:

 
levels.addLevel([
 
buildObstacle(​'platform'​, 0, 0.5 * height/2 * Math.random()),
 
buildObstacle(​'platform'​, 0, -0.5 * height/2 * Math.random())
 
]);
 
levels.addLevel([
 
buildObstacle(​'platform'​, 0, 0.5 * height/2 * Math.random()),
 
buildObstacle(​'platform'​, 0, -0.5 * height/2 * Math.random()),
 
buildObstacle(​'stalactite'​, -0.33 * width, height/2),
 
buildObstacle(​'stalactite'​, 0.33 * width, ...

Get 3D Game Programming for Kids now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.