Hey All!
Continue to my latest thread where I Re-Program the ALL base engine of my game:
I'm working on the Player's basic mechanics now and how he will react as a platformer while interact with other objects such as enemies.
Since I can't share the capx, I'll do my best to describe and SHOW the issue and maybe you can help me out here:
The short version:
The Problem: Player's Animation Priority is acting weird with a delay.
When the player collide by enemy: "HIT" Animation stuck on first frame for a bit then playing. My guess is because of the Platform animations priority: IDLE / WALK on floor / not on floor etc..
The long version where I try to describe best:
(Sorry about my bad English.)
I have: INPUT and ANIMATION GROUPS so I can handle the Knock-Back (ignore INPUT on enemy collision).
So far so good, everything works!
Originally, the player also Flashing when collide with enemy, but for better visual example on the specific animated GIF I disabled it so you can see the issue.
THE ISSUE:
As you can see the on collision the player is "trying" to run the "HIT" animation from beginning but it stops for a few ms and then begins.
I tried MANY ways to solve this:
- I made the animation to start when the variable IGNORE is "on" and back to idle when it's "off".
- I tried when Flashing is on run the "HIT" animation, and back to idle when it's finished.
- I tried to make a dedicated Boolean variable for the "HIT" animation condition.
- I tried to cancel other animations while HIT is on, got messed up results.
- I tried to "force" the HIT animation using every tick.
All these and other attempts failed... (probably because I don't understand Construct yet, still a newbie)
In my simple brain it should be easy:
as long as IGNORE variable is "on" the "HIT" animation is playing. when it's "off" change to IDLE animation.
Right now on my current code, the IGNORE works on collision for 1 second (with or without Flashing) so it's not depending on the flashing time. there is a "wait 1 second" on the collision event which ignore my INPUT group and it works fine.
Player "HIT" Animation is 2 frames (loop forever just like idle so I can use stop it when I want)
My Conclusion:
After some tests, when I disable these 2 events:
- Platform is moving + Platform on the floor = Set animation to "WALK" (play from beginning)
- Platform on stopped + Platform is on floor = Set animation to "IDLE" (play from beginning)
ONLY THEN the "HIT" animation works correct as it should once the collision happen for 1 second (that's what I want) then back to IDLE.
BUT... now there are no WALK and IDLE animations because these are the BASICS of my player animation movements.
I do have other animation conditions such as JUMP, FALL, Landed.
I disabled every single one to make sure that the problem is related to what I've mentioned above and it make sense that it can't play the "HIT" animation because it must play the other animations first, only THEN it will play the "HIT" that is why there is that DELAY that looks like it freezes the first frame of the "HIT" animation and then when the Player stops it will continue playing it.
So what is the solution?
How can I set the priority of the "HIT" animation to take-over all the others while IGNORE variable is "on" ?
The only way I can think of right now is a bit more advanced for my level but my stuuupid brain tells me to try and build some kind of ANIMATION PRIORITY SYSTEM using a variable to control each animation on specific events to overwrite each other when needed.
it's nice in theory and all, but please consider I'm still new to Construct and it's I'm learning as I build this game, I still have much more to learn but I hope you can guide me to a simple-as-possible solution.
Maybe there is a plugin, or built-in feature to solve this?
maybe my conclusion is wrong and it's not even the issue and the solution is totally different?
Yes... I'm very confused.
Thanks ahead for any help!