Page 1 of 1

animation question

PostPosted: Fri Jul 20, 2007 4:16 pm
by Freddy
Alright, I have different animations for my character in a game I want to create, but I have a few animation problems. For example: I want the enemy
actor to get hurt when it collides with the animation of my player, 'punch', or something like that. But I dont want the enemy character to be hurt when it collides with my player, just when it is just standing. How can I do this?

PostPosted: Fri Jul 20, 2007 6:58 pm
by Jay S.
Maybe this would help... enter this in a Draw Actor event for the player:

Code: Select all
if(animindex==2)
{
//stuff...
}

And so on...

So say, for example, you have three animations: standing, walking and punching. The standing animation would be animindex 0, walking would be 1, and punching would be 2. Just say which animation you want for this action, then enter the events in the "if."

I hope I said that in a comprehensible manner... :)

PostPosted: Fri Jul 20, 2007 11:24 pm
by DilloDude
Here is the way I would do it:
you want separate actors. Make the part of you that does the damage a different actor from the rest of you. For example, if your player is a guy with a sword, then make an actor 'player' and another 'sword'. All animations would have to match up. When sword collides with an enemy, test if it is swinging (either by animindex or by a special variable) and do damage accordingly. The advantage to this method as oppesed to using one actor with variables is that you can still get hurt. So if I swing with a sword, and somebody touches me in the face, I die, not him.
A similar method involves one single graphic that is displayed and two hidden actors that aren't. The player would then have an image the basic shape of the player, and would do all the stuff that a player normally does. The attack part would be the shape of the part that does damage (whether it's a sword, a fist, or whatever).

PostPosted: Sat Jul 21, 2007 3:00 pm
by Freddy
To Jay S., Dont worry, I understood everything, Thanks! :D
To DilloDude (love the name), Interesting concepts, thanks for the options.
:D

PostPosted: Sun Jul 22, 2007 2:06 am
by DilloDude
Of course, there are advantages to using the second method I mentioned. First, you have a different collision area for the player, so that obscure parts of the graphic don't collide. Second, the part that does damage is always there. Otherwise, if you did a slash around to the side, whilst facing one direction you could hit the enemy where if you were facing the other direction you wouldn't because the sword is behind you and is not showing in that spot.