R
R
Riley Usagi2018-12-20 13:45:57
iOS
Riley Usagi, 2018-12-20 13:45:57

Swift. Game process. How to implement the process of simultaneous battle?

Good afternoon, ladies and gentlemen. A novice iOS developer ( Swift )
addresses a question to connoisseurs . At leisure, I decided to write for myself and friends a simple (logical, not animated) game with ordinary labels, lists, inputs and other default rubbish. However, I stuck at the most important and most difficult, for me, moment. There are two objects in the game - Hero and Monster . The main process of the game is the battle of these two objects. Each of them has parameters: Attack (Int) , HP (Int) and AttackDelay (Float) . The gist of the question is this:


How to organize the process of their simultaneous battle so that it ends if the HP parameter of one of them becomes equal to zero?
As I understand it, is it impossible to do without all kinds of Threads/GCD/NSOperations ? But even if so, then ... how? =)
Thanks in advance for possible answers.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question