Meet Chris A.! He’s teamed up with instructor Dilan as part of Game-U’s New Jersey Accelerate program. Chris is learning how to use Unity, the professional gaming engine, and he just completed his first game development project! Check it out.
Chris began his project, a mini racing game, by collecting 2D digital assets from Unity’s Store. Digital assets are images, soundtracks, or 3D models that game developers use to add visual or audio components to their games. For his game, Chris needed a player car, an opponent car, a group of traffic cones, a finish line flag, a beachside environment, and a flock of seagulls. Chris and Dilan kept this game’s assets simple to give Chris time to get used to Unity. Once he collected all the project assets, Chris laid out his level, setting up the environment (overlaid by the seagulls asset to add more interest) as well as the player, the opponent, and the traffic cone obstacles, to form a race course. Chris then moved on to provide the scripts that bring these assets to life!
Even the best asset can’t do much on its own – it needs code to program its actions in the game. Code usually combines with assets to drive the mechanics (such as win conditions or pickups) that make games function. Using C#, the programming language, Chris modified prefabricated scripts to give his game functionality. Notice the timer in the top left corner of the screen? Per Chris, it uses a regularly incrementing number variable to display the gameplay time where the player can see it. What about the moving car? Chris coded that asset to respond to keypress events, like W, A, S, and D, to move in different directions on the screen’s XY axes. Once that car passes the finish line, still more code displays a text variable (“Win”) on the screen, letting the player know he or she has completed the race course and won the game!
Well done, Chris! You’ve created a cool mini game and you learned a lot about Unity in the process. Keep up the good work, and be sure to stay in touch! We’re excited to see what you build next.