Outline the Game
In addition to lights, this game will have a ball, a game board, and a goal. Letâs start with the following code outline, including the double slashes:
â | â//var lights = addLights();â |
â | â//var ball = addBall();â |
â | â//var board = addBoard();â |
â | â//var goal = addGoal();â |
Just as we did in Chapter 14, âProject: The Purple Fruit Monster Gameâ, weâll uncomment these function calls as we define the functions.
Add Lights
Before doing anything else, letâs add some lights to the scene.
Below the commented-out code outline, add the following function definition of addLights:
â | âfunctionâ addLights() { |
â | âvarâ lights = ânewâ THREE.Object3D(); |
â | |
â | âvarâ light1 = ânewâ THREE.PointLight(â ... |
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.