animate while player gets hurt...

Posted By: Anonymous

animate while player gets hurt... - 02/20/10 20:52

hi again!

i want the player to play this hurt animation if he gets hurt by the enemy. this is the part i use in the enemy action:
Code:
action enemy_fight3 // attached to the enemy
{
while(!player) { wait(1); } 
...					
ent_vertex(my.sword_tip, 1840);
ent_vertex(my.sword_base, 306);
trace_mode = ignore_me + ignore_passable;
trace (my.sword_base, my.sword_tip);
if (result != 0)
{
//my.enable_impact = on;
my.event = player_damage;
effect (particle_blood, 2, target, normal);
if (you != null) {you.health -= 2 * time;}
ent_playsound (my, zombie_wav, 50); 
}
ent_cycle("attack", my.skill20); 
my.skill20 += 5 * time;
wait (1);
...



and this is the "player_damage" function i call in the playe_action:
Code:
function player_damage()
{
if (you == player)
{

               ent_animate(my, "hurt", my._animdist, null);
               my._animdist += 3 * time_step; // "3" controls the animation speed
               wait (1);

}
}



Problem: The animation wont play frown
i know there is something wrong, i tried some, but nothing worked. can u help??
Posted By: Slin

Re: animate while player gets hurt... - 02/21/10 01:45

Check, if the event is triggered by for example printf, if it is, I think it should be you._animdist and not my.
I actually doubt that it can look good to animate an object in an event, as it should look quite jerky, but at least you should see something. It would probably be better, to just notify the player in some way, that he was hit and then react to it with a complete animation cycle.
Posted By: mikaldinho

Re: animate while player gets hurt... - 02/21/10 12:46

instead of you_ or my_ could you use player_animdist?
© 2024 lite-C Forums