Keep on Coding


It has been a week for getting the functionality of the game into play, with trying to work through a lot of code and prefabs to have a game that is somewhat playable. This game is has somewhat suffered in terms of the functionality, as a lot of time and effort has gone more into the design aspect with the sprites, UI, and sounds, and as such now is the time that has been put into fixing this.


Some basic scripts for this game, I already have from previous projects that required only some small adaptations to be able to make work well, especially for the attacks. These just required some quick changes to call the correct animations with the increased number of attack abilities a player has for this game and to instantiate different prefabs to damage the enemies.

Gut punch / normal attack animation


The most interesting, and turning out to be relatively simpler than I had anticipated was working on a raycast to move towards the player / players if two player mode is activated. This did require some debugging as I wanted it to pick up which player was closest to enemies and for them to switch between the players depending on how the players moved them around on the screen. This did cause some issues initially, but after debugging it and learning to understand foreach in C# to detect all those with a certain tag in the scene, it allowed for this work quite effectively.

Raycast gizmos


Lastly getting player 2 to spawn in and then ensuring the destroy function in my code was working in other areas besides just my attack hitbox clones. Making sure that when the 2nd player was spawned, pressing the key wouldn't spawn an army of 2nd player characters to control was one of the first things to be programmed before even working on turning on the character and their appropriate UI elements. Attaching a spawn position to the player 1 character so that even if the 2 player mode was engaged halfway through the level, it would always spawn next to the 1st player character was an interesting puzzle to solve and one that I am glad I did and is something I shall take on to further projects as a simple attached transparent sprite that stuck to the player 1 character was all that was required to make this work.

2 Player mode go!

Get Comfort Squad

Leave a comment

Log in with itch.io to leave a comment.