Need some help with 2 animation looping on same key press

0 favourites
  • 11 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • i have 2 animation

    attack1 and combo1

    on A key press my player will play attack1 animation and if the key is press again with under 0.25sec my player will play combo1 animation.

    The problem is on the 3rd key press and so on it keep play the combo1 animation until the key is release then it will stop, how do i make my player keep repeating the animation to attack1 animation back after the animation combo1 is done even if i spam the the key?

    see my event sheet here https://www(dot)dropbox(dot)com/s/58yjzoz5e8864bs/Untitled.png?dl=0

  • Maybe you could try this ?

    On animation combo1 finished >> play animation attack1

  • I wouldn't personally use a wait action at event 15. I learned the hard way that in this circumstance, a timer is generally superior.

    Place a timer behavior on your player object.

    replace the condition at event 15 by "Attack1count = 0" (instead of <= 1)

    replace "add 1 to attackcount" by "set attackcount to 1"

    replace the wait action by "start timer for 0.25 seconds"

    delete subtract 1 from attackcount

    add event :

    Player object, On timer --> set Attack1Count to 0

    event 17:

    add condition : Keyboard > on A pressed

    add action : set Attackcount to 2

    Depending if you want to allow the player to spam attack1 after combo1, you may want to add "start timer for 0.25 seconds" (or a different value) at event 17, so that attack 1 couldn't be launched before 0.25 second.

    I don't know if it's clear, I didn't tried it in the editor and I'm not 100% sure that I understand what you want to achieve, but hopefully it'll help.

  • Maybe you could try this ?

    On animation combo1 finished >> play animation attack1

    I'm afraid the attack1 animation will play even if the button A isn't pressed again.

  • Try something like this: ( Combo1 is a Global Variable)

    System > every tick - System add to > add dt to Combo1

    Now just add your events:

    Keyboard > on A released set Combo1 to 0

    System > compare Combo1 - equal or less than 0 - On A pressed Play Attack1 from beginning

    System > compare Combo1 - greater than 0 - On A pressed Play Combo1 from beginning

  • Already use the timer but it stop when attack1 animation is finish

    and using the dt i just dont know where to start

    ive read tons of combo forum and video tutorial nothing solve my problem but i think the timer method is how it works

    its like when combo1 is finish and the key is not press under 0.25sec, player play idle animation, but if the key is press under 0.25sec after combo1 is finish, player play attack1 animation back and this process will repeat over and over again until i stop spamming.

    this is the capx www(dot)dropbox(dot)com/s/qi51yuvcpg0rtgi/IworryabouttheWarrior.capx?dl=0

  • To use the dt, i showed you how to try, just copy what i wrote.

    I have something a little like what you are trying to do. It may work. It may not. Won't know till you try.

    If you need help with my example, me.

  • To use the dt, i showed you how to try, just copy what i wrote.

    I have something a little like what you are trying to do. It may work. It may not. Won't know till you try.

    If you need help with my example, me.

    what you mean me ? cant you give me your example here? i cant pm you

  • + allevlativ = allevlativ

    And look at my previous post. Just add a global variable. Call it whatever you want.

    Add the events and actions just like my post.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • jeffige done like what you post

    now when i run the game my player not play idle animation, it stuck on combo1 animation and when i press the A key its only play the combo1 animation

  • allevlativ

    What behaviours do you have for this object?

    Platform?

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