From Basic Shapes To A Work Of Art
Why we should always prototype without assets.
I don’t think I’ve actually shown any images from my game so far. But it just consisted of cubes as both the player and enemy, with a capsule as our lasers. That’s probably why I didn’t show it off…
Working with primitive shapes allows us to focus on getting the core concept and mechanics running properly, and saves extra stress while troubleshooting. Personally, I had to revert to my primitive shapes and start again when importing my sprites the first time. I had some strange behaviors occurring, and reverting back actually allowed me to notice a bug I had before changing the look of the game. If I hadn’t of reverted, I would’ve been driven mad trying to work out why my new sprites were causing my spawn manager to act up.
GameDevHQ has an amazing library of assets within Filebase, a Unity plugin that allows for easy selection and importing. There’s even a whole 2D space shooter pack, even if I intend on creating or finding alternative art in the future, having a whole cohesive pack allows us to take the next step with our game.
Many of our sprites are animated, but to simply get things working, we can take a single frame of our sprite and add it to our game. We used 3D shapes as our primitive design, but our sprites are all 2D. Unity has separate physics engines for the two, so we need to create new game objects with our sprites and add 2D rigidbodies and colliders. Keep the primitive shapes for now to confirm everything’s set the same. You will have to double check and most likely alter your colliders to the right shape and size.
Other than the physics, everything else can simply be transferred across, names, tags, empty containers, and scripts.
As you can see, we now have some space ships and a laser. Let’s add a background!
Again, the Filebase asset pack has a nice overlay to apply on our screen. Dragging it in to the scene view and simply resizing it whilst looking at the game view, allows us to now have a pretty good looking game!
If you don’t have Filebase, the Unity asset store has a lot of free or very cheap packs for most common simple game types.
One thing to note when using 2D sprites is the sorting layers. Creating and assigning different sorting layers for backgrounds and foregrounds allows us to properly render our ships over top of the overlay we just added. Within each layer we can also assign an order number.
I would also like to recommend implementing one new sprite at a time and checking all your mechanics are still working so it’s a lot easier to troubleshoot. It’s okay to only have a player ship and everything else be primitive shapes in the meantime!
With that, we have now gone from some simple cubes to what looks like a functional demo. There’s still more visually to do, and more game mechanics to add, but at least things look like they’re progressing!