So I’ve been making a game with turn based combat, and as I found a way for it work at first, now that i’ve added more enemies it doesn’t work. Can someone help me find a way to switch turns only when all attacks are finished? A good example is (Bandit 1).
Here’s my game- https://flowlab.io/game/play/1391363
Wish I could help, I really do, but I have no idea how turn-based combat even work, if I figure something out I’ll tell.
It’s a bit laggy too on my device, but also. Mario and Luigi inspired combat? Seems like it, I am a fan
I’ve never played those, I just replaced Paper Mario’s block with a jump. But yeah Mario, I’m glad you like.
Does anyone have an example of turn based combat?
I do I have a discussion where I made turn based combat with a speed stat dont remember if I broke it or not ill send the link later when im out of school
If I have time today I will take a look at the game and make some suggestions.
Could you explain exactly what is currently happening and exactly what you want to happen?
Okay right now I have it to where the turn ends when an enemy takes damage or the blade goes out of bound, but when there are multiple enemies it causes you to start your turn before the enemies are done. So i’d like to find a way to start the turn only when all the attacks have finished.
I would suggest getting rid of the “blade out of bounds” and “enemy takes damage” then. Instead, you will need another way of checking when the turn is over. I don’t know your coding style or the exact game mechanics, but could you possibly do something like:
Option 1: Send a message when each enemy’s turn is done. Once you have received “turn done” messages (you can call the message whatever you want) from every enemy the player is facing, THEN you can start your next turn. You could maybe check HOW MANY messages you get, and depending on how many enemies you are facing, you can start the player’s turn after you have X amount of messages from enemies (where X is the number of enemies in that battle).
Option 2: Rather than sending a message, use global variables to do the same thing. So, when an enemy finishes their turn, change the global variable (for example: “enemy1_turn”) to 1. Same thing for enemy 2 and so on. Once the global variable for every enemy the player is currently fighting is turned to 1, the players turn starts again. You should set the global variables for all the enemies back to 0 as well, so the cycle can repeat until the fight is over.
You could also possibly use a not gate where each enemy sends a message that it is still doing its turn, and once all the turns are done and no more of those messages are being sent the player turn starts again. I’ve never tried this so it is purely theoretical, let’s see how things work!
I think I got a solid method, but i’m curious if that would work, maybe we could callab on something and find out.
Did you end up figuring it out?
I believe so, Maybe more effort could be made. But thank you.