2D Golf Enthusiast: "No, the other thing you said."
Announcer: "A magnificently, fiery 2D golfing game utilizing features in Unity's new 2D Toolkit, including Vector Art, 2D Animation, SpriteShape, and Cinemachine!"
2D Golf Enthusiast: "What? No, I'm pretty sure you said something about fire..."
Announcer: "Ha ha ha! Fantastic! Right this way to play!"
The Magmulligan level selection screen provides players with information about the hole before they jump into the action. The hole's par score can be found under the level name along with an aerial view of the hole's terrain.
Once a player selects a level, they can begin golfing! Moving the left and right directional keys will move the golf ball's launcher clockwise and counter-clockwise respectively. Holding down the space bar will change the size of the launcher. Releasing the space bar while the launcher is large will launch the golf ball further.
The goal is to reach the end of the level with as little strokes as possible. Be sure to avoid the rough patches, fallen trees, and lots of hot fire!
Using Unity's 2D Toolkit
Magmulligan utilizes the Cinemachine Virtual Camera to smoothly follow the golf ball throughout the level. The player can also zoom out with the 'Z' key at any point to see an aerial view of the current hole. This is achieved with a custom script that does the following.
When the player input is detected, the empty object that the Virtual Camera is set to follow is moved to a new position. By moving this object from the player to an object with a position that has a nice aerial view of the course, the Virtual Camera will quickly and smoothly follow the object to its new position. Releasing the 'Z' key moves the object back to the player, making the Virtual Camera smoothly move back to the player.
The art assets in the game are Vector Graphics (svg) created in Inkscape and imported into Unity. Assets that used Unity's 2D Animation were exported as PNGs from Inkscape and then imported into Unity. Once imported, I viewed the asset in the Inspector Window and changed the Texture Type to Sprite (2D and UI) and opened the Sprite Editor. In the Sprite Editor, I used the Bone Editor and the Skin Weights And Geometry Editor to prepare the sprite for animation.
Once the sprite was added to a scene, I would add the Sprite Skin component to it and select the Generate Bones button in the Inspector. From there, I could move the bones and use them in an animation. Using the Animation Window, I created keyframes of the bone positions, and the animation smoothly moved between the keyframes. When the animation was completed, I made sure that the object had an Animator component that was using the Animation that I just created.
All of the terrain was made utilizing Unity's SpriteShape tool. Assets that were used with SpriteShape were converted from Vector Sprite to Textured Sprite in the Inspector. Then, I would create a Sprite Shape Profile asset that used that sprite. Once a Sprite Shape Profile was made, I created a Sprite Shape 2D Object that used my profile. Finally, I could adjust the shape and angle of the Sprite Shape using the Edit Spline button in the object's Sprite Shape Controller component. The object's Edge Collider was generated using the Sprite Shape Controller's Update Collider checkbox.