More on Real Time Battles

Started by Destroyer, Tue 11/11/2003 00:18:52

Previous topic - Next topic

Destroyer

I'm attempting to make battle sequences in real time. Now so far, it's pretty good. I use FollowCharacter to have enemies go after the character. If the player and enemy get too close to each other, I can make some things occur. Yet what I really want is when they get close to each other, I want the enemy to animate an attack, maybe swinging a sword at the player and taking the players health away. I figured that since I needed animations from all four sides (up, left, down, right) that I could just use in Repeatedly Execute


if ((character[EGO].x-character[EN].x<8 && character[EGO].x-character[EN].x>-8 && character[EGO].y-character[EN].y<8 && character[EGO].y-character[EN].y>-8)){
FaceCharacter(EN, EGO);

if (FaceLocation(EN, "down coordinates")){
ChangeCharacterView(EN, 4);
AnimateCharacter(EN, 0, 2, 0);
ReleaseCharacterView(EN);
SetGlobalInt(2, (GetGlobalInt(2) - 5));
}
if (FaceLocation(EN, "left coordinates")){
ChangeCharacterView(EN, 4);
AnimateCharacter(EN, 1, 2, 0);
ReleaseCharacterView(EN);
SetGlobalInt(2, (GetGlobalInt(2) - 5));
}
if (FaceLocation(EN, "right coordinates")){
ChangeCharacterView(EN, 4);
AnimateCharacter(EN, 2, 2, 0);
ReleaseCharacterView(EN);
SetGlobalInt(2, (GetGlobalInt(2) - 5));
}
if (FaceLocation(EN, "up coordinates")){
ChangeCharacterView(EN, 4);
AnimateCharacter(EN, 3, 2, 0);
ReleaseCharacterView(EN);
SetGlobalInt(2, (GetGlobalInt(2) - 5));
}
}
}


But it fails to work. I just want to make it so the enemies animations will occur with each direction, depending on where the player character is. Is it just not possible? Or am I doing something wrong?



Gilbert

#1
Actually I don't understand what is FaceLocation(EN, "down coordinates"), etc, maybe you can do this:

if ((character[EGO].x-character[EN].x<8 && character[EGO].x-character[EN].x>-8 && character[EGO].y-character[EN].y<8 && character[EGO].y-character[EN].y>-8)){
FaceCharacter(EN, EGO);
int lop=character[EN].loop;
ChangeCharacterView(EN, 4);
AnimateCharacter(EN, lop, 2, 0);
while(character[EN].animating) Wait(1);
ReleaseCharacterView(EN);
SetGlobalInt(2, (GetGlobalInt(2) - 5));
}

SMF spam blocked by CleanTalk