Gamestudio Links
Zorro Links
Newest Posts
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 827 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 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