Canceling

0 favourites
  • 5 posts
  • How you guys handle canceling?

    EDIT@ If you don't know what canceling is, that's making events stop if event of higher priority happens for example: I attack with melee weapon, but the moment I press the button for jump it immediately stoops attacking ( like in devil may cry for example). So how you'd set priorities for it?

  • ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you don't know what canceling is, that's making events stop if event of higher priority happens for example: I attack with melee weapon, but the moment I press the button for jump it immediately stoops attacking ( like in devil may cry for example). So how you'd set priorities for it?

  • Well, say for example you're using the animation "Attack", in which, you have events prepared for damaging, such as;

    On Collisions Player + Enemy

    +Is "Attack" animation playing

    +Is Frame 5 playing

    • Do damage

    Then making "Cancelling" would be a breeze! Simply detect the jump ("Has Space key been pressed?", "On Jump" in platform behaviour), set animation to "Jump", thus cancelling the rest of the Attack animation!

  • Your gonig to then need to create a list with priorities. Can't say exactly how to do it. There are many ways. but if we are using your example you don't really need one. Just do the action you pressed. I think what your looking for is to NOT overide current priority as canceling is naturally built into programming.

    pc.cur_priority

    On Press Attack

    if pc.cur_priority < pc.attack_priority

    -> pc.animate stuff

    -> pc.cur_priotiy = pc.attack_priority<1>

    On Press Jump

    if pc.cur_priority < pc.jump_priority

    -> pc.animation stuff

    -> pc.cur_priority = pc.jump_priority<2>

    On Press Dash

    if pc.cur_priority < pc.dash_priority

    -> pc.animation stuff

    -> pc.cur_priority = pc.dash_priority<1>

    Now as we can see in this simple example assuming that idle = 0.

    That from Idle the PC can do any and all action.

    However from Attack, Dash cannot be done. But Jump can.

    From Jump neither Dash or attack can be performed.

    You may want to add timer triggers to reduce priority after a period of time.

    On Press Dash

    if pc.cur_priority < pc.dash_priority

    -> pc.animation stuff

    -> pc.cur_priority = pc.dash_priority<1>

    -> wait(0.5) -> pc.cur_priority = 0

    That way available actions can open up.

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