|
|
|
@ -93,7 +93,7 @@ void FaceBall::InitializeEnemyData() { |
|
|
|
|
enemyData[EXIT] = { "EXIT",undefined,GREEN }; |
|
|
|
|
enemyData[START] = { "SPAWN POSITION",undefined,{128,64,0} }; |
|
|
|
|
enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,PI / 8,2,1 }; |
|
|
|
|
enemyData[ISHOOT] = { "ISHOOT",enemy_IShoot,YELLOW,1,1,PI / 6,2,1,0.4f }; |
|
|
|
|
enemyData[SHOOTME2] = { "SHOOTME2",enemy_IShoot,YELLOW,1,1,PI / 6,2,1,0.5f }; |
|
|
|
|
enemyData[SONAR] = { "Sonar",enemy_Sonar,RED,5,1,PI / 8,2,1 }; |
|
|
|
|
enemyData[COIN] = { "Coin",undefined,BLUE }; |
|
|
|
|
enemyData[POWERUP_ARMOR] = { "Armor",undefined,{96,0,96} }; |
|
|
|
@ -1532,7 +1532,33 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) { |
|
|
|
|
case SHOOTME: { |
|
|
|
|
e.rot += 0.5 * fElapsedTime; |
|
|
|
|
}break; |
|
|
|
|
case ISHOOT: { |
|
|
|
|
case SHOOTME2: { |
|
|
|
|
switch (e.GetPhase()) { |
|
|
|
|
case Phase::DEFAULT: { |
|
|
|
|
vf2d movementVec = { std::cosf(e.rot) * dat.movSpd * fElapsedTime,std::sinf(e.rot) * dat.movSpd * fElapsedTime }; |
|
|
|
|
if (-1 == CheckEnemyCollision({ movementVec.x,0,movementVec.y }, { e.pos.x,e.pos.z }, e.radius, myIndex) && |
|
|
|
|
!CheckCollision({ movementVec.x,0,movementVec.y }, { e.pos.x,e.pos.z }, e.radius)) { |
|
|
|
|
e.pos.x += movementVec.x; |
|
|
|
|
e.pos.z += movementVec.y; |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
e.SetPhase(Phase::TURNING); |
|
|
|
|
e.turnAmt = PI; |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case Phase::TURNING: { |
|
|
|
|
if (e.turnAmt > 0) { |
|
|
|
|
float rotAmt = std::min(e.turnAmt, dat.rotSpd * fElapsedTime); |
|
|
|
|
e.turnAmt -= rotAmt; |
|
|
|
|
e.rot += rotAmt; |
|
|
|
|
if (e.turnAmt <= 0) { |
|
|
|
|
e.SetPhase(Phase::DEFAULT); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case ISHOOT2: { |
|
|
|
|
switch (e.GetPhase()) { |
|
|
|
|
case Phase::DEFAULT: { |
|
|
|
|
vf2d movementVec = { std::cosf(e.rot) * dat.movSpd * fElapsedTime,std::sinf(e.rot) * dat.movSpd * fElapsedTime }; |
|
|
|
|