Animation woes...

0 favourites
From the Asset Store
4 Block Soldiers with different animations, 400x400
  • I'm completely redoing the animation system in my game, Sneaky Ninja, but I seem to have hit a snag. The ninja's usually holding something, and his hand is a separate object set to one of his image points, which works perfectly fine as you'd expect it to. When I tried implementing the turn-around animation, though, it flips out for a single tick. It's really quick, but it's extremely noticeable, and I've spent the last three hours trying to find a way to get rid of it with no luck.

    The ninja himself also flips out for a single tick, only when turning to the left. Again, extremely noticeable, and seemingly impossible to fix.

    I made a super basic version with only 8 events to show the problem. Press any key to make him turn, and well, see for yourself. <img src="smileys/smiley5.gif" border="0" align="middle" />

    db.tt/TukM7llC

    EDIT: Oh, and the way I have things set up may seem a bit strange at first, but trust me when I say it's (mostly) necessary. It's a bit of an odd animation system, but it's part of a bigger scheme... <img src="smileys/smiley2.gif" border="0" align="middle" />

  • I'm seeing it too, but as you say "seemingly impossible to fix".

    Maybe Ashley could tell you more about this.

    I don't know why, but it kinda feels connected to this bug report to me.

    Just an intuition.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That's not really a bug, that's because triggers works a bit like standalone events so you're never sure when they happen compared to normal events.

    ninjaTurn.capx

  • Good job

  • Thanks Yann! That works fine, but... the way it was set up before, the turn animation ping-pongs and mirrors so that it looks as smooth as possible. This way only plays half, so he starts turning to the left, then halfway through teleports to the end of it, if you know what I mean.

    Maybe it's only the kind of thing I'd notice, but if at all possible I want to have the full thing play. I tried altering yours to include that, but the imagepoints are acting up again... Mind taking another look?

    dl.dropbox.com/u/19702035/ninjaTurn.capx

    (The timescale is set to 0.1 so you can really see what's happening. If it's set to 1 and you make him turn repeatedly, you can see it doesn't happen every time, just most of the time. I don't know if that's important or not.)

  • Here's a fix:

    ninjaTurn Fix

    The problem is caused when you flip frame 3 instead of the frame after frame 3 during the turn. So it gets flipped one frame before it should.

    I fixed by flipping frame 3 in the image editor to keep the events simple the way they are, so when you flip it in events it will be in the correct orientation.

    This solution is kind of hacky though. It would be better if there was a way to check if the ping-pong animation is forward or backward.

  • Perfect! Thanks a lot guys. Who knows how many more hours of blankly staring at the screen it would've taken for me to notice that? <img src="smileys/smiley36.gif" border="0" align="middle" />

  • That's how I would do it

    ninjaTurn2.capx

    Your way is too convoluted I think.

  • It certainly is convoluted, but like I said in the first post, there's a reason for it. It's hard to explain... trust me on this one. <img src="smileys/smiley5.gif" border="0" align="middle" />

    It's not like it's THAT much more complicated anyway. No big deal!

  • Well I don't think there that much difference between this last capx and yours, you should explain a bit, so I know what to change and what to keep (:

  • I was going to say don't worry about it, since Animmaniac's fix works, but after porting it into the full project, I just realized that it actually doesn't... <img src="smileys/smiley5.gif" border="0" align="middle" />

    Alrighty, explanation time. The ninja, as you see, is just a blob, so most of his animations are him bouncing around like a cartoon ball. The previous animation system used frames to do all of this, but the new one uses far less frames and instead stretches and squishes him by changing width/height with events. Unfortunately, that makes it a lot more difficult to use mirroring; since that works (presumably?) by making the width negative, if you use "Set width" and set it to a positive number, it messes things up. I couldn't get that working right, so rather than use mirroring to make him face left, I used a second frame and flipped it in the editor.

    This is the basic animation system, with everything but walking and turning cut out. Hopefully you'll see what I mean:

    db.tt/UCWRhbcs

  • I haven't downloaded your capx yet (won't tonight, it's too late) but reacting on what you wrote.

    I'm wondering why you bothering with mirroring and frame changes if the trick about negative width/height actually really does change the orientation of the image, just use a single frame and lerp the way out of it's width/height all in events.

    It sounds to me you did half the job of controlling your anim through events and you stopped in the middle when you should have gone fully for it.

    I'll have a look at your capx after some sleep and if nobody has proposed something in the meantime.

  • Kyatric, apparently you can't actually set it to negative and change the orientation yourself. At the same time, if the sprite is mirrored and you try to set the width, it cancels out the mirroring. So essentially it seems the two can't work together at all.

    If anyone else who looks at the capx thinks they have a better way to do it, by all means take a swing at it! I just don't think it's possible to do that way.

  • works fine with me

    ninjaTurn3.capx

  • So it does indeed work! The tough thing here is... I don't really understand that stuff. <img src="smileys/smiley36.gif" border="0" align="middle" /> I'll be using these techniques for a lot more than just walking animations, and I'd rather stick to what I'm comfortable with for all that.

    If it's literally impossible to do it the previous way, I'll force myself to learn how to effectively use lerp and sin and all that good stuff, but if it is possible I'd rather use that.

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