Scoreboard
Weâll want to keep score in this mini-game, so letâs add a scoreboard. Below the line that creates the new Launcher(), add the usual scoreboard code:
â | âvarâ scoreboard = ânewâ Scoreboard(); |
â | scoreboard.countdown(60); |
â | scoreboard.score(0); |
â | scoreboard.help( |
â | â'Use right and left arrow keys to point the launcher. 'â + |
â | â'Press and hold the down arrow key to power up the launcher. 'â + |
â | â'Let go of the down arrow key to launch. 'â + |
â | â'Watch out for the wind!!!'â |
â | ); |
â | scoreboard.onTimeExpired(timeExpired); |
â | âfunctionâ timeExpired() { |
â | scoreboard.message(â"Game Over!"â); |
â | } |
You can skip the help text for now if youâre eager to get back to coding. Just donât ...
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.