Hi everyone,
I'm not sure if this is entirely a Pixi related question but, there may be something in Pixi that may help with this and maybe someone here would know the best way to do it.
I'm building a prototype of a game where the player and the CPU will end up with a list of Actions and I will have to compare the outcome of those actions by comparing the 1st Player actions to the 1st CPU action, 2nd Player action with 2nd CPU action, etc... until all actions are resolved.
I already have this working, however, the actions are resolved all in a single pass and that's it. In order to make things more interesting and be able to add some animations for the resolution of the outcomes, I would like (somehow) to be able to resolve the 1st Actions show the outcome and animations, then move to the 2nd action show the outcome and animations, etc... until all actions are resolved.
As an example, let assume that the players have only 2 actions: the resolution of the first pair of actions would inflict 50 damage to the CPU and the resolution of the 2nd pair of actions would Heal 20 HP to the CPU. What I have at the moment shows only the end results (like CPU that a total of - 30 HP)
What I'm trying to achieve is:
- 1st Actions : show the 2 actions in questions, show the outcome of the resolutions, make an animation, show the CPU losing 50 HP and move to the next action
- 2nd Actions : show the 2 actions in questions, show the outcome of the resolutions, make an animation, show the CPU healing 20 HP and move to the next action
- etc...
The way I was thinking in approaching this, would be to handle the resolution of those actions inside a ticking function with a bunch of additional flags to help track in which state of the resolutions things are, BUT I'm not entirely sure if this is the correct/best way to do it.
Has anyone ever done anything similar? Does anyone have any suggestions based on your experience?
I'm using PixiJS with "pure" Javascript (and not typescript) if that is relevant in any way.
Many thanks in advance for the assistance.
- Miguel