Skip to content

Commit f69102f

Browse files
unknownunknown
authored andcommitted
attack <=> run bug fix
1 parent 5e5cfb4 commit f69102f

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

AIControl.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ void AIControl::PlayAction(int skip){
2929
}
3030
void AIControl::moveTowardLyubu() {
3131
for (int i = 0;i< this->npcStateMachineList.size(); i++){
32+
if (npcStateMachineList[i]->CanBeControl() == FALSE){
33+
continue;
34+
}
3235
int npcId = npcStateMachineList[i]->character;
33-
3436
FnActor lyubu;
3537
FnActor npc;
3638
lyubu.Object(this->lyubuId);
@@ -44,8 +46,8 @@ void AIControl::moveTowardLyubu() {
4446

4547
float distance;
4648
distance = sqrt((npcPos[0] - lyubuPos[0]) * (npcPos[0] - lyubuPos[0])
47-
+ (npcPos[0] - lyubuPos[0]) * (npcPos[0] - lyubuPos[0])
48-
+ (npcPos[0] - lyubuPos[0]) * (npcPos[0] - lyubuPos[0]));
49+
+ (npcPos[1] - lyubuPos[1]) * (npcPos[1] - lyubuPos[1]));
50+
//+ (npcPos[0] - lyubuPos[0]) * (npcPos[0] - lyubuPos[0]));
4951

5052
//sprintf(debug, "%s distance = %f\n",debug,distance);
5153

@@ -77,10 +79,11 @@ void AIControl::moveTowardLyubu() {
7779
npcStateMachineList[i]->ChangeState(STATERUN, FALSE);
7880
}
7981
else if (distance <= ATTACK_DISTANCE) {
82+
//sprintf(debug, "%s distance = %f\n",debug,distance);
8083
npcStateMachineList[i]->AppendAttackCode(NORMAL_ATT);
8184
}
8285
else {
83-
npcStateMachineList[i]->ChangeState(STATEIDLE, TRUE);
86+
npcStateMachineList[i]->ChangeState(STATEIDLE);
8487
}
8588
}
8689
}

GameControl.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,7 @@ BOOL GameControl::CharacterMoveForward(DIRECTION_CODE code){
4444
}
4545

4646
// please check "beBlock" and decide what to do.
47-
if (code == MOVE_FORWARD) {
48-
//GameControl::CamFallow();
49-
}else if (code == MOVE_BACK) {
50-
//GameControl::CamBackOff();
51-
}else if ((code == MOVE_LEFT || code == MOVE_RIGHT) && beBlock == TRUE){
47+
if ((code == MOVE_LEFT || code == MOVE_RIGHT) && beBlock == TRUE){
5248
GameControl::CamRevolution(code);
5349
}
5450

@@ -469,7 +465,7 @@ void GameControl::CamMove(float skip){
469465
cam.MoveForward(-0.1, FALSE, FALSE, 0.0, TRUE); //prevent the actor be under the camera, or it can't go out there
470466
firstBlock = FALSE;
471467
}
472-
sprintf(debug, "%s Camera is blocked\n", debug);
468+
//sprintf(debug, "%s Camera is blocked\n", debug);
473469
float pos[3];
474470
cam.GetWorldPosition(pos);
475471
if (pos[2] > CAM_MAX_HIGHT) {

0 commit comments

Comments
 (0)