Remember Jerard? He teamed up with instructor Andrew as part of Game-U’s Accelerate program. Last week, Jerard and Andrew got started on a racing game using Project Spark. This week, they took it to the next level!
Jerard’s eager to learn and Andrew’s a Project Spark wizard, keen to pass along his skills, so obviously the two of them didn’t stop at just a simple racetrack with victory fireworks (even if it also has a game timer, a four-legged friend, and a win condition). They created new features to make the game more functional. This meant including an automated racing opponent, requiring 3 laps rather than 1 to win, implementing a placement system that tracks lap time and displays a picture of who’s in first and who’s in second, and – to top things off – incorporating a “3, 2, 1, GO!” countdown into the start screen! Check out the logic the guys used to make this race happen!
First things first – the opponent racer. The guys added a Goblin Bruiser prop to the game and Koded him to move similarly to the player (though not quite as fast – he doesn’t have a four-legged friend to help him!). Since the Goblin Bruiser has no human controller, however, he follows a preset path around the racetrack until he completes the requisite number of laps. But how does the computer keep track of the goblin’s laps? Or the player’s, for that matter? Ah! Jerard and Andrew know the answer to those questions. They placed an extra condition in the timer’s Kode, a variable called “Current Lap” that increments by 1 every time a racer crosses the checkerboard terrain. Only after the value of the Current Lap variable surpasses 3 do the victory effects play.
Now what about the placement system? The guys created variables to hold racer times for each lap, and set them to display, in order, in the top right corner of the screen – with helpful, color-coded smaller lines underneath to show which racer made better time! On the left of the screen, a heads-up display includes “1st” and “2nd” placements, which start out empty. Each time the racers complete a lap, however, the HUD updates to show a picture of each racer in the appropriate placement. Perfect!
The final touch for this game comes at the beginning of the race. It’s a countdown! All of the game time and racer movement Kode goes beneath a three-second countdown trigger, so that the racers can’t move and the timer doesn’t start until the countdown is up. More timers control the “3,” “2,” “1,” and “GO!” tiles that display, in succession, front and center on the screen. Once the “GO!” tile flashes, the players charge the starting line. It’s official – the race is on! Check out the video to see all these features in action!
Just wow, guys. You’ve built an awesome racing game that shows us what code (or, as Project Spark prefers, Kode) can do. Thanks for sharing your work with us, and be sure to keep us updated on your future projects! They’re sure to be equally amazing.
Leave a Reply