Combo system with animation

digitalzerodigitalzero Member, BASIC Posts: 639

I'm trying to develop a combo system that completes the animation and if the button is still pressed then it will go to the next animation .... You're probably thinking there's a or of tutorials like this online which there are but with my animation sequences I'm always having to make a timer to determine if the animation is done so the animation won't get cut off.... So let's say this for example my first slash will have 4 frames of animation and it hits the enemy the second will have 5 frames and it hits the enemy without messing up or interrupting the first phase of animation... Can someone please help me out with this because all the timers I would have placed would mean that my game would lag... Even more.

Comments

  • BellowBellow Bartender Member, PRO Posts: 227

    if you are pressing button again and again for combo combination try this.

    create a game attribute call it : combo

    put this rule to attack button

    when touch is pressed (or key whatever you are using)

    change attribute combo to combo+1

    and give this rule for every combination for resetting your combo

    if game.combo attribute = 1

    do

    timer

    after 1 second

    change attribute game.combo to 0

    and again at the new rule

    if game.combo attribute = 2

    do

    timer

    after 1 second

    change attribute game.combo to 0

    ...

    if game.combo attribute = 56

    do

    timer

    after 1 second

    change attribute game.combo to 0

    i don't know your combo count so use this for everyone.

    after that come to combo actor (hero actor i think)

    give this rule

    if attribute game.combo = 1

    do

    animation this

    at the new rule

    if attribute game.combo = 2

    do

    animation this

    ....

    at the new rule

    if attribute game.combo = 56

    do animation this

    you want to use timer for animations and your game.combo attribute.

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2015

    @digitalzero said:
    . . . with my animation sequences I'm always having to make a timer to determine if the animation is done so the animation won't get cut off....

    I'd dump all the timers and just use the name of the last frame to determine if your animation has finished playing with a simple rule.

    For example - let's say you have an actor with an 8 image sequence - and the 8 images are named like this: . . . Kill_1, Kill_2, Kill_3, Kill_4, Kill_5, Kill_6, Kill_7, Kill_8 . . .

    And you want something to happen when the last frame is reached, then the rule would look something like this:

    When self.image contains 8
    --Do something

    One caveat on animation timing, with the above method the rule will trigger as soon as frame 8 is reached, whereas what you want is for the rule to trigger after frame 8 has played . . . so if you are running your animation at - for example - 15fps, then ideally you want the rule to trigger 1/15th of a second after it has reached frame 8, so frame 8 gets its 1/15th of a second on screen like all the previous frames, you can achieve this by throwing in a duplicate of the last frame - name it something like 'End Kill' - and use this as the trigger, so your real last frame (8) gets to play for 1/15th of second, now your rule will look like this:

    When self.image contains End Kill
    --Do something

  • digitalzerodigitalzero Member, BASIC Posts: 639

    Omg socks this is exactly what I was looking for.... I have one more player actor in which this is perfect for., so question @Socks if I were to label my animations whatever let's say slash-1 slash-2 slash-3 and end kill it would work just as if I were on the next combo label it hit-1 hit-2 hit-3 and end kill-2 and let's say there's a Boolean which we will call "animation ended" in a rule would I then write...

    If (any) self.image contains end kill or end kill-2 or end kill-3 and so on...
    Change attribute self.animation false

    Otherwise self.animation is true...

    In another rule ...
    If b button is pressed AND if self animation is false then trigger an animation? Hope that makes sense

  • SocksSocks London, UK.Member Posts: 12,822

    @digitalzero said:
    . . . Hope that makes sense.

    Nope ! I didn't understand any of that :smile: Haven't got a clue what things like 'combo labels' might be.

    Here are some spare commas I have which I don't need (,,,,,,,,,,,,,) help yourself :wink:

  • digitalzerodigitalzero Member, BASIC Posts: 639

    lol sorry I'm horrible at explaining things lol I think I'll be able to figure it out now that I have had your help... Thanks!!!

Sign In or Register to comment.