2 x IGNORE = Mess ??

0 favourites
  • 11 posts
  • Hey All,

    Continue from my latest threads with my journey and learning as I go...

    Now I got into a new issue that I'm scratching my head can't solve it.

    I'm using 2 Separate IGNORE systems on my Player Engine:

    1

    - When the player collide with enemy he will Knocked-Back + IGNORE for 1 second.

    I also made an "Animation-Priority-System" so I can overwrite any other animation like in this case I want it to cancel any animation and play the "HIT" animation while the knock-back is happening.

    2

    - When the player press 'C' = Attack animation starts + IGNORE Player for less than a second.

    I made it so it will stop the Player on any movement including Walk / Jump / Fall while attacking.

    The mechanic's goal is to limit he player so he won't be able to MOVE while attacking.

    Current Status:

    When testing each case of the 2 Ignore, separately they are working GREAT!

    The Problem:

    When the player Jump or Fall while Attack + Collide with the Enemy there is a mess with the 2 ignores and it seems like currently it won't use the "MAIN" ignore as I want (IGNORE #1 with Knock-Back for 1 second)

    The result is mix of both and more like (IGNORE #2 the attack stops) mess it.

    It's probably an animation issue, I did try to solve it with the Animation-Priority-System I made yesterday which saved my Knocked-Back animation, which supposed to be the highest one.

    The animation does work on the highest priority but the IGNORE is NOT... working and I can control the Player while he is on the "Knock-Back" animation which is NOT supposed to happen.

    Again, if I test each IGNORE situation separate they work fine.

    I tried to add stuff such as:

    if Attack Animation is playing or while it is playing and stuff like that, nothing solved the IGNORE issue, the animation plays correct, but not ignored as it should.

    I'm not sure exactly how to fix this and hope you can help me out, I know it's hard without exploring my actual capx which I can't share but I'll do my best to show and give information.

    It's not a super secret capx, I just keep it as it's about to be my official game project, I hope that you understand and willing to help, I appreciate it a lot.

    Thanks ahead and Sorry about my bad English.

  • It's hard to understand what's going on by your screenshots, but I believe the reason for your problems is "Wait" action.

    You are creating multiple Wait threads, that can clash and produce unpredictable results. You should never use Wait in events like these.

    I recommend adding Timer behavior to your character. Disable controls, start "Ignore" timer, use "On timer" event to re-enable controls.

    The huge advantage of Timer behavior over Wait is that you can control it - you can restart the timer for a longer time if needed, stop it, pause (by setting object time scale to 0), calculate elapsed and remaining time etc.

  • It's hard to understand what's going on by your screenshots, but I believe the reason for your problems is "Wait" action.

    You are creating multiple Wait threads, that can clash and produce unpredictable results. You should never use Wait in events like these.

    I recommend adding Timer behavior to your character. Disable controls, start "Ignore" timer, use "On timer" event to re-enable controls.

    The huge advantage of Timer behavior over Wait is that you can control it - you can restart the timer for a longer time if needed, stop it, pause (by setting object time scale to 0), calculate elapsed and remaining time etc.

    I know it's a total mess and hard to find my bug without capx but I appreciate your help, thanks!

    So since I'm still a newbie, I may did something wrong (again) but I tried your suggestion and I translated all my "wait" into Timers instead.

    The timers works just like the wait so I know for first time I did set the Timers correct consider it's new to me.

    The result = Exactly the same issue.

    Here is an example of actual what happens:

    1 - GOOD: When attack on floor or air, character stops (ignored for 0.3 sec)

    2 - GOOD: When touching the Enemy without attack, Knock-Back and Ignored for 1.0 sec.

    3 - THE BUG: When COLLISION WITH ENEMY + ATTACK, the main IGNORE 1.0 sec is not working as I need it. (Animation "HIT" works as it should).

    I'm not sure where is the clash exactly, that is why I don't want to continue add stuff to the game before I solve this major bug.

    I have a strong feeling it's related somehow to the Animation Priority System, but I can't tell...

    I'm still trying disable / enable some to get the idea what break it while scratching my head.

    Any other ideas? tips what can I try to solve this and make the first IGNORE to work over the Attack-Ignore ?

    Thanks ahead for any suggestion or help!

  • The best solution is to reproduce your issue/systems in a new project and provide us with a copy for it.

    It is not possible to investigate your issue as it is.

    The use of "Trigger once" is confusing in your collisions events.

    They are already triggered events that only trigger once while true.

    Nevertheless, with the added use of "Trigger once", your actions will only be executed once, and the next time your event is executed, those actions are supposed to be ignored.

    And this was before you used timers, who knows what your project looks like now. You do, we don't.

    Provide a copy of it and it will be easier for us to investigate and answer accurately.

  • The best solution is to reproduce your issue/systems in a new project and provide us with a copy for it.

    It is not possible to investigate your issue as it is.

    The use of "Trigger once" is confusing in your collisions events.

    They are already triggered events that only trigger once while true.

    Nevertheless, with the added use of "Trigger once", your actions will only be executed once, and the next time your event is executed, those actions are supposed to be ignored.

    And this was before you used timers, who knows what your project looks like now. You do, we don't.

    Provide a copy of it and it will be easier for us to investigate and answer accurately.

    Thanks Kyatric! I appreciate your reply and detailed explanation.

    If I won't be able to solve this I will try to Re-Create a capx so the community can have a look and help.

    For now, I found a temporary solution but it is not perfect...

    I made that the "HIT" animation a.k.a "Anim_Priority = 1000" will set the INPUT group deactivate.

    so as I brutally press attack while collide with the enemy it works but the minor is that I can still change the direction of my character the moment he touches the floor for a milli sec and than the IGNORE starts.

    I even put the Direction / Mirror event inside the INPUT group but that didn't solve the issue.

    It's not how I want it to act because when Knocked-Out will always works that the Direction will stay the last one before collision. Anyway it's not critical but as I'm perfectionist it's annoying only for me, the player probably won't even notice this...

    As I'm still learning C3 and you guys are AMAZING with your tips, I would like to understand something:

    Trigger Once:

    How do I know if the action will trigger once or not? that's why I used it and it's not working well without the Trigger one... so I'm very confused now.

    Wait v.s. Timers:

    Should I actually NEVER use the wait? and use Timers only for less bugs and issues? or it's just in very specific parts?

    To be honest, the "WAIT" looks much cleaner with 1 line compare to Timer that needs a bit more (not bothering me, I'm just looking at my code now).

    Thanks again for the help and for your patience with me!

  • How to use the Wait action

    Also wait 0 sec will make the following actions execute on the next tick of execution.

    Wait and timers have different use.

    In this case though, timer is likely a better idea. You need to "block" your character for a given time, the best way is indeed to change its state, run the timer, at the end of the timer modify the state again.

    And make sure that during the "blocked" state, everything is indeed blocked as intended.

    A triggered event only happens when the conditions to its execution are met and are generally "external" (a collision between two object, a user's input, ...).

    They are notified by the green arrow next to it.

    They are not "checked" every tick, like other events are.

    By the sound of it, you are perhaps looking in the wrong direction though.

    If your arrows still allow to change direction, are you sure it is not in your keyboard events that something is messing up the overall logic.

    Again, hard to tell without seeing all the events and logic you did put in place.

  • Thank you for the information Kyatric this is very helpful!

    I will read that article and hope that I'll understand the idea consider I'm not a programmer.

    [quote:34tlidzb]By the sound of it, you are perhaps looking in the wrong direction though.

    If your arrows still allow to change direction, are you sure it is not in your keyboard events that something is messing up the overall logic.

    That's the thing, because I had issues with overwrite "HIT" animation on everything else I created this "Animation Priority-System" and it solved that Knocked-Back issue I had on my other post.

    That's why I thought I ruined so many other things because of that... big chance it's true.

    So, it is probably related to the keyboard as you said but the keyboards and attack are all in the INPUT group,

    at first I even put the Directions (mirror) inside, but it didn't matter so I separate it for organize sake.

    I have a feeling you will be able to tell where is the bug just by looking at my mess for the player on the attached images.

    I'm not expecting you to understand the mess from the images, but I wanted to share because it's better than nothing, you'll probably notice a big issue right away.

    Thanks again!

    This is the INPUT group:

    This is most of the ANIMATION group

    This is the Priority-System I came up with and it helped me so far with my early issue:

  • Or maybe I did a mess with the Timers??

    After all it's the first time I use Timers instead of Wait.

  • Wait and Trigger Once are probably the most misused events in Construct.

    Trigger Once is executed once when other conditions in this event are all true. (or, if there are no other conditions, then it will be triggered once on the start of layout).

    If other conditions become false and then true again, then this event will be executed again.

    Many beginners think this event means "trigger only once in the game", which is wrong.

    Wait is a convenient way to add a delay, but I prefer only using it for unimportant stuff and short delays - like Wait 0.5s, spawn Particles. It shouldn't be used in situations where you control game mechanics.

    Imagine you have an event like this:

    On collision with PowerUp sprite -> Player Set speed to 500, Wait 5s, Set speed to 200

    What happens when you pick up one power-up, and then after 4 seconds pick up another one? You expect it to "recharge" your speed for additional 5 seconds, however after 1 second the first "wait" kicks in and resets the speed back to 200.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Wait and Trigger Once are probably the most misused events in Construct.

    Trigger Once is executed once when other conditions in this event are all true. (or, if there are no other conditions, then it will be triggered once on the start of layout).

    If other conditions become false and then true again, then this event will be executed again.

    Many beginners think this event means "trigger only once in the game", which is wrong.

    Wait is a convenient way to add a delay, but I prefer only using it for unimportant stuff and short delays - like Wait 0.5s, spawn Particles. It shouldn't be used in situations where you control game mechanics.

    Imagine you have an event like this:

    On collision with PowerUp sprite -> Player Set speed to 500, Wait 5s, Set speed to 200

    What happens when you pick up one power-up, and then after 4 seconds pick up another one? You expect it to "recharge" your speed for additional 5 seconds, however after 1 second the first "wait" kicks in and resets the speed back to 200.

    VERY GOOD explanation! I have much more to learn and test these on my actual game, so far it's the best way for me to learn thanks to you and others who help. even if I will or will not solve my current or future bugs I appreciate it a lot! I hope that others newbies will use this information if needed as well.

    I did transform from WAIT to Timers as you can see on the image above your post.

    But from your explain I get the impression that my use for wait is perfect since it's only 0.3 second or 1.0 second to activate and deactivate, but then I read the Article and understand it's not ideal for Functions so I changed to Timers... I just like how in 1 line we can put wait X seconds, while Timers are a bit more work but nothing critical of course.

    The "trigger only once" may confuse me because I came from ClickTeam Fusion and not that I was super-user but I started with the basic logic such as the "Every Tick" = "Always" when I compare it to Fusion... now I'm getting used to Construct 3 and everything is MUCH MORE CLEAN and fun to learn as I work on this game.

    I hope that you guys can have a rough look on the images above, maybe the issue is on my INPUT group or in the Timers and you can point me what I did wrong right away.

    I know it's not as good as explore an actual capx, but to recreate one takes longer then capture for a quick look.

  • I would remove "trigger once" from event 76, otherwise your screenshots look ok to me.

    I suggest debugging. Run the project in Debug Mode (Ctrl-F4), get to the point where your game glitches, pause it and check everything.

    You can also add "Browser Log" actions to your key events to output variable values, animation names and other useful information. This often helps to understand the sequence of events in the project.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)