Code: Fruit Hunt

This is the avatar code after we added it to the fruit-hunt game in Chapter 11, Project: Fruit Hunt. This code uses WebGLRenderer to make the trees a little prettier, but the CanvasRenderer should work nearly as well.

 
<body>​</body>
 
<script src="http://gamingJS.com/Three.js​"></script>
 
<script src="​http:​//gamingJS.com/Tween.js"></script>
 
<script src="http://gamingJS.com/ChromeFixes.js">​</script>
 
<script src="http://gamingJS.com/Scoreboard.js​"></script>
 
<script src="​http:​//gamingJS.com/Sounds.js"></script>
 
<script>
 
// This is where stuff in our game will happen:
 
var​ scene = ​new​ THREE.Scene();
 
 
// This is what sees the stuff:
 
var​ aspect_ratio = window.innerWidth / window.innerHeight; ...

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.