Turn Base Manager


Hey everybody welcome to another weekly blog!

Overview 
This week I decided to tackle turn controls. Or better said "How can I end my players turned and start my enemies turn?" Let's get started.

Problem 1
So when tackling players turn? I had to decide? How do I even know if it is the player's turn well? I thought we could make an enum saying Hey, it's players turn and the other index saying Hey, it's the enemies turn simple right. Wrong. I forgot to consider one crucial control. So I will say it again how would I know WHOSE TURN it is???? I got so lost in thought that I started falling down a rabbit hole (this rabbit hole led me to a laundry list of unnecessary code aka the image above) adding different controls like bools on different characters... but this rabbit hole not only led me to a lot of dead ends but it also led to an even simpler solution.

Solution 1
To solve this problem I needed a CURRENT TURN. The reason why the Manager needs to know who's the current player is because it will manage the turns at all times. I currently have a simple event call, called "active characters turn" which determines the current turn for the enum. However, that's not the only control I have. I also have a bool on the player called "isYourTurn" doing the same. Do I need both no. However, I may be removing the enum entirely because the bool made it very clean and even easier to access. But I am also willing to keep it because later down the line we will be implementing who goes first determined by the speed stats of the characters on the field of play. So now, my enum is checking who's turn it is for each the player an enemy. While also checking the bool in the player. I know later down the line when we add party members to the team the Manager will need tweaking. Or simply put the enum will just need to be updated with the party members.

Get Quest for Dominion

Leave a comment

Log in with itch.io to leave a comment.