Turn-Based Combat in Unity

Let’s create a simple turn-based battle system using Unity.

► Plan your next video game in Milanote:

● Project files:

Learn more about UI:
● UI Introduction:
● Start Menu:
● TextMeshPro:


♥ Subscribe:

👕 Check out Line of Code!

● Join our Discord:
● Website:
● Twitter:
● Instagram:


► All content by Brackeys is 100% free. We believe that education should be available for everyone. Any support is truly appreciated so we can keep on making the content free of charge.


♪ “ES_Dress Code_Black – oomiee” by Epidemic Sound

Nguồn: https://openworldleague.org/

Xem thêm bài viết khác: https://openworldleague.org/category/game


  1. Anybody have a problem at 16:40? I don't get any compile errors in Visual Studio, but in Unity, I get an error in the console saying : 'BattleHUD' does not contain a definition for 'SetHUD' and no accessible extension method 'SetHUD' accepting a first argument of type 'BattleHUD' could be found (are you missing a using directive or an assembly reference?)

  2. Hey Asbjørn, so much to say. Firstly a massive thank you for helping me get into game dev. Less than two years ago I knew nothing of this world, but since watching your videos and using them almost exclusively as a learning resource, I've gone from zero to…competent coder (bet you thought I was going to say hero). I was saddened to hear your announcement on ending your Brackey's videos, but as the old saying goes, don't be sad that it's over, smile because it happened and thanks to the medium, your youtube videos remain and are still a vital resource that I plunge into on a regular basis. Your professional approach to making clear and informative tutorials were (and still are) an absolute God send. I have you personally to thank for this new skillset and wish you the best of luck for the future.


  3. How to save the health slider value going from scene 1 to scene 2? Can someone please reply this ASAP, I need to finished my project in like a week, and saving health slider is the only thing I have not finished yet.

  4. I want to make a game that has a timer to attack for both but you still have to press attack/skill/potion/escape. How would I make the timer?

  5. This is awesome! I’m just starting to learn and this was very helpful. Thank you ^_^

  6. Fantastic tutorial.

    I added a call to SetupBattle() at the end of EndBattle(), to make it loop and replay battles. It does, but I notice each time it loops, I get another pair of Enemy(Clone) and Player(Clone) objects appearing in the Hierarchy, eventually dozens after playing several times.

    What's the best way to go about destroying those? Tried various approaches, none really work.

  7. I'm new in Unity and I hope someone sees this comment. Why in 5:15 it necessary the empty object? I think using just the sprite as game object like he did in the battle stations should do the same, or is just because it's easier to create a prefab?

  8. the problem is: if you heal more HP than the amount of damage the opponent deals to you, it's just a free win! otherwise, the opponent just has to constantly attack to defeat you! I would make a system where one attack deals damage, and the other one reduces the opponent's defense.

  9. Either I skipped something you did or mashing your attack button can actually call multiple coroutines in a row
    and since the damage is calculated before the GameState tansition (due to the yield new Wait…) we can instantly
    damage the opponent to death with a few clicks per second. I added another GameState called WAITand set it
    to WAIT in the OnAttackButton() before the coroutine is called. Good solution? Did I miss something?

    Great video btw, you really help me get into the unity classes and UI!

  10. Can someone explain what is the difference between putting a sprite directly for the characters on screen, vs creating an empty object and attaching a sprite as a child?

  11. Here is a quick breakdown of what would be really nice for milanote to be able to

    * Create references to other boards anywhere (like a hyperlink)
    * Create a KanBan board that can connect to all todo lists (KanBan boards are used by a lot of professionals for organizing which todo tasks are more important to least important and include a backlog)
    * Better tutorial and/or documentation if not already available on how to use milanote, if available make it easier to access

    I'll add onto this if/when I come up with better and/or more ideas. This is just my first impressions messing around with Milanote for an hour. Let me know what you think 🙂

    Otherwise this is a really good tool for organization!!!!

  12. Hey! anyone could control the the health by moving the slider, while playing the game

  13. really it took you 17 minutes and 22 seconds to get to the part why we are all here?

  14. Does anyone know how to destroy the enemy after you’ve won? I can’t seem to figure out the correct destroy script.

  15. Can anyone Help? i got to the HUDs part and it won't let me pass in playerUnit in the battle system because it can't convert from unit to int.

  16. Great vid! Would you be willing to show how to trigger a fight like this from a 2D setting?

  17. I don't feel like this is flexible at all. I mean, coding the different actions with their own functions inside the battle system script, really ?

  18. How do you add more attack than 1?
    I want to have like 4 different attacks like pokemon

Leave a Reply

Your email address will not be published. Required fields are marked *