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=â"/three.js"â></script> |
â | <script src=â"/tween.js"â></script> |
â | <script src=â"/scoreboard.js"â></script> |
â | <script src=â"/sounds.js"â></script> |
â | <script> |
â | â// The "scene" is where stuff in our game will happen:â |
â | âvarâ scene = ânewâ THREE.Scene(); |
â | âvarâ flat = {flatShading: âtrueâ}; |
â | âvarâ light = ânewâ THREE.AmbientLight(â'white'â, 0.8); |
â | scene.add(light); |
â | |
â | â// The "camera" is what sees ... |
Get 3D Game Programming for Kids, 2nd Edition 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.