Skip to content

Narwhal Simulator 12: A modular player

Hi everyone! Since Tuesday I’ve been hard at work on modularising the player in Narwhal Simulator. For now, the process is complete! The player is now split into several parts which are theoretically able to interact. In this post, I’ll be discussing how I did this. This post will be shorter than usual because there’s not all that much to talk about. If you’re more curious about the technicals, check out the last post about object oriented programming or check out the code on GitHub.

I have made the player’s parts system. I’m calling it the parts system because the different additions to the player are separate and I’m calling them parts. The parts system allows the base Player class to add, remove, and swap different parts both at the start of the game and on the fly. It’s not perfect and it’s also not very well tested, but as I use it, I’ll be testing it and improving it along the way. Without further ado, I’ll show you it in action:

The narwhal we know and love
Upgrading the tusk to a new red one seamlessly in game!

That’s great! The player will now be able to upgrade themselves in-game without too much effort or processing power.

The parts system works off of GameObject prefabs, GameObjects that can be copied and instantiated. This allows the different parts to do pretty much anything. Here’s an example of rainbow body:

Rainbow Narwhal!

Well that’s everything I have to talk about today. As usual, you can ask any questions you may have in the comments or email me. If you want to see the code and try it out for yourself, check out my GitHub (linked below). For the next few weeks, I’ll be working on making a store for the player to buy new upgrades. Thanks for reading, see you Friday!

Links recap:

GitHub: https://github.com/AgentD1/NarwhalSimulator

Trello: https://trello.com/b/Nd7rNvWU/narwhal-simulator

3 thoughts on “Narwhal Simulator 12: A modular player”

Leave a Reply