Basic Questions

Die_In_Fire

Well-known member
Ok I'm having a very basic question related to attack.
I have a very basic attack animation. It's a punch that when connected, will do another attack. (anim attack1 with followcond4). the problem is that it doesn't play the full anim attack animation before playing the anim follow4 animation.
I have done this countless times but only here it presents a problem. It's past 3am here so maybe it's my fault and I'm missing something.
here's both animations:

Code:
anim attack1
range   0 25
    loop 0
    delay 10
   offset   43 75
   bbox   35 45 14 29
  followanim 4
  followcond 2
   frame   data/enemy/a2/27.gif
   frame   data/enemy/a2/52.gif
   frame   data/enemy/a2/53.gif
   frame   data/enemy/a2/53a.gif
   delay   15
    attack1  45  49  19  14  3  0 0 0 0 8
   frame   data/enemy/a2/56.gif
#        attack1 0
#   delay   8
#   frame   data/enemy/a2/54.gif


anim follow4
    range 0 25
    loop 0
    delay 10
    offset 43 75
    bbox  37  45  13  29
    jumpframe 2 0 1 0
    hitfx    data/sounds/kbeatko2.wav
    followanim 6
    followcond 2
    frame   data/enemy/a2/18.gif
    frame   data/enemy/a2/19.gif
    frame   data/enemy/a2/27.gif
    delay 20
        attack1 48  55  16  16  8  1 0 0 0 8
    frame   data/enemy/a2/28.gif
        attack1 0
    frame   data/enemy/a2/27.gif

In the first part of the video you can see anim attack WITHOUT followanim active. Here the anim attack1 plays entirely.
In the 2nd part of the video you can see anim attack WITH followanim active. Here the animation is cut. Doesnt play 56.gif and weirder than that, 56.gif is the only frame with attackbox, but it plays that attackbox at 53.gif, two frames earlier.
video:

I'm also uploading as gifs:
attack1..gif = anim attack WITHOUT followanim active
attack2.gif = anim attack WITH followanim active
 

Attachments

  • attack1.gif
    attack1.gif
    278.5 KB · Views: 1
  • attack2.gif
    attack2.gif
    412.5 KB · Views: 1
thats how openbor follow condition works as soon as you get a hit it changes animation you need a script to change at the end of a animation that checks there was a sucessful hit.

C-like:
void followatk(char next_anim)
{//follow attack just specify the next anim like this "@cmd followatk ani_follow4" on the frame where you want to change over.
 
void self = getlocalvar("self");

  int hits = getentityproperty(self,"animhits");
    if (hits >= 1)
    {
      performattack(self, openborconstant(next_anim), 1);
    }
}
 
That's how it's supposed to work. When the engine detects a valid followanim, it switches to the new animation instantly. This seems counterintuitive, but when you think about it makes sense for versatility.

If you want the original animation to "finish", you just need to duplicate the remaining portion of its frames in the follow animation.

DC
 
Again, that's how it's supposed to work. The very absolute nanosecond the engine detects a hit, it switches to the new animation. This effectively happens before the frame that makes contact ever visually appears on screen. To you it's looking like 53.gif is the one making contact, but the animation is doing exactly what it's supposed to do.

This is what your follow animation should look like. Note I also removed loop 0 and range. Loop 0 does nothing and follow animations don't need range unless you're using it for script. Side note, ditch .gif dude. We've had .png support for more than a decade now.

Code:
anim attack1
range   0 25
    loop 0
    delay 10
   offset   43 75
   bbox   35 45 14 29
  followanim 4
  followcond 2
   frame   data/enemy/a2/27.gif
   frame   data/enemy/a2/52.gif
   frame   data/enemy/a2/53.gif
   frame   data/enemy/a2/53a.gif
   delay   15
    attack1  45  49  19  14  3  0 0 0 0 8
   frame   data/enemy/a2/56.gif
#        attack1 0
#   delay   8
#   frame   data/enemy/a2/54.gif


anim follow4
    delay 15
    offset 43 75
    bbox  37  45  13  29
    jumpframe 3 0 1 0
    hitfx    data/sounds/kbeatko2.wav
    followanim 6
    followcond 2

    # Finish parent animation.
    frame   data/enemy/a2/56.gif

delay 10

    frame   data/enemy/a2/18.gif
    frame   data/enemy/a2/19.gif
    frame   data/enemy/a2/27.gif
    delay 20
        attack1 48  55  16  16  8  1 0 0 0 8
    frame   data/enemy/a2/28.gif
        attack1 0
    frame   data/enemy/a2/27.gif
 
@msmalik681 thanks for the script
@DCurrent thanks, did the proposed change. But now that follow plays different skipping last frames of animation, which didn’t before. I removed the followanim 6 followcond 2 inside that animation.

About .pngs, yes I’ve been switching for years, just have been too lazy to change all the old gifs, but all stages I already converted into .pngs and also the new sprites, just need to batch convert all the old sprites that are still as .gifs
 
Back
Top Bottom