Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (AndrewAMD, ozgur, AbrahamR, wdlmaster), 849 guests, and 7 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
animate while player gets hurt... #311598
02/20/10 20:52
02/20/10 20:52

C
chris_oat
Unregistered
chris_oat
Unregistered
C



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??

Re: animate while player gets hurt... [Re: ] #311625
02/21/10 01:45
02/21/10 01:45
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
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.

Re: animate while player gets hurt... [Re: Slin] #311707
02/21/10 12:46
02/21/10 12:46
Joined: Feb 2010
Posts: 457
Norfolk,England
mikaldinho Offline
Senior Member
mikaldinho  Offline
Senior Member

Joined: Feb 2010
Posts: 457
Norfolk,England
instead of you_ or my_ could you use player_animdist?


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1