Page 1 of 1

Complicated Fighting for a game, HELP!PLZ!

PostPosted: Fri Apr 06, 2007 2:30 pm
by jimmynewguy
O.k so I want certain animations to destroy enemy actors, but if I'm not using those attacking animations and collide with an enemy I want my charater to take damage. :? I tried writing a code for this but I come up with an error and the game wont run :shock: N e 1 no y? heres the code I tried :D
Code: Select all
if (animindex == getAnimIndex("normal-link-attack"));
if (animindex == getAnimIndex("normal-link-downthrust"));
if (animindex == getAnimIndex("normal-link-lowattack"));
{
DestroyActor("Collide Actor");
}
else
{
health = health - 1;
healthtext.textNumber = healthtext.textNumber - 1;   
}

Ya......... it's a Zelda game :D

PostPosted: Fri Apr 06, 2007 3:12 pm
by makslane
The problem is the ;
The ; ends a command, so, your ifs don't will works.
And, you must use the || to make OR conditions:

Code: Select all
if (animindex == getAnimIndex("normal-link-attack") ||
    animindex == getAnimIndex("normal-link-downthrust") ||
    animindex == getAnimIndex("normal-link-lowattack")) //Without ; here
{
  DestroyActor("Collide Actor");
}
else
{
  health = health - 1;
  healthtext.textNumber = healthtext.textNumber - 1;   
}

PostPosted: Fri Apr 06, 2007 3:36 pm
by jimmynewguy
oh....... I see thanx heres another point for ur help! :D :D