Animation looks... glitchy?
AssortDis
Member, PRO Posts: 22
I'm trying to make an actor (named MC) to do an instant jump to the air, then he'll do an attack animation right after the jump and slowly falling down to the ground. However, the animation during this process looks really weird.
Here are my rules:
1. Rule Create Gravity:
Accelerate in direction: 270 with acceleration 1000
2. Rule Animate Falling:
If collides with Ground: Change Image to MC (which is also the actor image).
Else animate Falling (2 frames)
3. Rule Re-check Falling state:
If self.mod1 > self.time%0.1, do the Rule Animate Falling above
4. Rule Collide:
Bounce when colliding with Ground (Both MC and Ground actors are set to 0 bounciness)
5. Rule Attack:
When mouse is up, do:
For 0.12 timer, run to completion: animate Jump (3 frames) at 25 fps
After 0.12 timer, run to completion:
Change self.position.x and self.position.y to somewhere in the air.
Animate Attack (4 frames) at 20 fps
That's it.
And the result: Right after the MC attacked, the Falling animation doesn't appear. Instead it shows the MC's still image when falling down. Sometimes it shows the Falling animation as it should be but most of the times, it's just a still image. Maybe I'm missing something in the rules?
Comments
Hey @AssortDis,
It might be possible that somewhere in your animations you have it checked to restore actor image when done. try turning that off and see it it helps at all. That's just something I thought of off the top of my head. Let me know.
@KillerPenguinStudios,
No, I'm afraid it's still the same even when I turned off all Restore actor image. And it now even has one frame of the earlier Jump animation appear for a split second during the MC's falling down. So I guess it's worse than before.
Hi AssorDis your animations look glitchy because you haven't enough frames in your animation sequences.
For instance, your animate attack at 20fps with only 4 frames, say over 1 second, you're only seeing a frame every quarter of a second, which isn't enough to register flowing movement. For graphics, you can probably get away with 8 frames (or more) so you'll need intermediate frames between the ones you already have to get smooth movement.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
@gyroscope,
Oh I see. I'll add more animation tonight when I get home. Thanks for your help!
@gyroscope,
I'm afraid it still doesn't work out right. Now it looks as if the actor can't decide between the falling animation state and the attack animation state, making the image keeps changing between the two state and looks really weird.
I'll try some other stuffs to see if I can fix this today but I don't expect good result...
Ah, OK, something to do with your programming now - but at least you've got smoother animation when that side of it is sorted.
I'm off out soon so haven't the time at the moment but will take a look at what's going on when I come back (unless someone else beats me to it...)
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hi, at a quick look at your Rules, by the sound of it, you've either got the wrong frames in the wrong animation... (can happen!) or they are the right frames but in the wrong order, or you haven't allowed for looping and so where it carries on from the end frame to the first frame again, it glitches.
Or the second animation is kicking in while the first is still running - or vice versa...
Difficult to tell without seeing more detail of your programming, to be honest. Hope what I've written helps tho'.
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Hi @gyroscope, I figured out that the reason is due to the Falling animation (which is continuously active by the Gravity rules) still running when the Attack animation is activated. So the actor can't decide between the two animation states.
I solved this by putting another boolean condition to the Gravity rule so that if self.linearVelocityY < 0 it will turn on gravity and turn off when VelocityY = 0.
But now it still results in a slight problem. It's hard for me to put this problem into words so if you like, when I get home I can upload the file here for you or anyone here to look at.