HomeВидеоигрыRelated VideosMore From: Design and Deploy

Unity 5 - JRPG Turned Based Battle System - Part 9

15 ratings | 937 views
Category: Видеоигры
Html code for embedding videos on your blog
Text Comments (6)
Jadandlud (3 months ago)
In order for the Debug to show the remaining HP of either hero after being attacked, what I did was to move the Debug code into the 'heroAttacked' code and modify for the other character. It looks something like this: if (heroAttacked == 1) { witchcon.witchHP -= enemyAttPow; Debug.Log("Witch HP " + witchcon.witchHP); } else { suitcon.suitHP -= enemyAttPow; Debug.Log("Suit HP " + suitcon.suitHP); } Hope this helps.
Rohn Adams (1 year ago)
+1 for casual mention of the possible infinite loop instead of teaching best practices to avoid such
culomanlgz (1 year ago)
These lessons are awesome. i'm just having trouble because i want there to be 4 heroes but i don't know how i should change up my if statement in the enemy script to get the enemy to attack players 3 and 4. he only attacks 1 and 2. i tried to add another else after and also "else if" but i guess i don't understand how to properly use the "else if". If you can help with that it will be very much appreciated.
Rohn Adams (1 year ago)
You'd need to alter the Random.Range() statement to include all possible "targets" instead of just 1 & 2. So, in your case, it becomes Random.Range(1,5); You can use if statements to check for 3 & 4 all you'd like, but if the statement driving that never generates a 3 or 4, that check is pointless. If you're looking into adding more enemies based purely on numbers, you might be better served by using switch statements instead of ifthens for clarity/brevity. Also, to comment on the caster's statement that Random.Range() documentation states that it is inclusive on both ends is incorrect. It is inclusive for the first parameter and exclusive for the second.
rob Carlton (2 years ago)
Can you make this tutorial work in 3D?
Rohn Adams (1 year ago)
Yes, you can.

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.