Complicated Fighting for a game, HELP!PLZ!

Game Editor comments and discussion.

Complicated Fighting for a game, HELP!PLZ!

Postby jimmynewguy » Fri Apr 06, 2007 2:30 pm

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
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Postby makslane » Fri Apr 06, 2007 3:12 pm

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;   
}
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby jimmynewguy » Fri Apr 06, 2007 3:36 pm

oh....... I see thanx heres another point for ur help! :D :D
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron