Play animation every time the character turns

Started by Oncer, Sat 03/09/2005 12:38:13

Previous topic - Next topic

Oncer

In my game, basically the character can walk into four directions (up,down,left,right), so I set "No diagonal loops".
But when the character turns, e.g. I walk to the left, then I walk to the right, he turns up and then right. This is okay, but the turn "animation" looks rather choppy. So I made animations of my character "rotating" from looking left to looking up, from up to right, from right to down, and so on. I hope you can follow me to that point. What I want is to play these "turn animations" whenever the character turns in another direction.
E.g. when I walk to the left and then to the right, the character should rotate from left to up and then from up to right, and then continue walking. That would look much smoother than the standard "characters turn before walking"-setting.

Anyone an idea how I could accomplish this?

Thanks in advance,
Oncer

Rui 'Trovatore' Pires

#1
It's not trivial, but here's my method (tested and works and bug-free). Make a dummy invisible character, and make your own "Walk" function. You'll call this function INSTEAD of your normal cEgo.Walk thingy. Do the function like CustomWalkTo(int x, int y, bool blocking, int walkto). Then in that function you make the DUMMY character move EXACTLY where you want the character to move, then Wait(1); to give it time to update (you may have to disguise your WAIT cursor by quickly setting it to another cursor, then changing it back to normal), and then get the DUMMY character's loop. THIS will tell you in what direction it turned. You can now play any appropriate anumations before actually calling, within that function, cEgo.WalkTo(etc), according to the parameters you set before.

What's the catch? Well, it works before you start to walk. Don't ask me how to do it WHILE you're walking.

EDIT - Oh I forgot... before you make DUMMY move you have to make sure cDummy.Loop=cEgo.Loop, cDummy.x=cEgo.x and cDummy.y=cEgo.y. And preceed ALL OF THIS with a "Is EGO walking" check.

You COULD ditch the check and see what happens. I remember it didn't work for my purposes, but it might for yours.
Reach for the moon. Even if you miss, you'll land among the stars.

Kneel. Now.

Never throw chicken at a Leprechaun.

SMF spam blocked by CleanTalk