Code: Turning Our Avatar
This is the code from Chapter 8, âProject: Turning Our Avatarâ:
â | <body></body> |
â | <script src=â"/three.js"â></script> |
â | <script src=â"/tween.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 the stuff:â |
â | âvarâ aspectRatio = window.innerWidth / window.innerHeight; |
â | âvarâ camera = ânewâ THREE.PerspectiveCamera(75, aspectRatio, 1, 10000); |
â | camera.position.z = 500; |
â | â// scene.add(camera);â |
â |
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.