|
|
|
@ -264,8 +264,10 @@ void FaceBall::InitializeEnemyData() { |
|
|
|
|
enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,0.5,2,1,0.2f,true }; |
|
|
|
|
enemyData[SHOOTME2] = { "SHOOTME2",enemy_ShootMe2,YELLOW,1,1,PI / 6,2,1,0.35f,true }; |
|
|
|
|
enemyData[ISHOOT] = { "ISHOOT",enemy_IShoot,YELLOW,1,1,0.5,2,3,0.4f,true }; |
|
|
|
|
enemyData[ISHOOT2] = { "ISHOOT2",enemy_IShoot2,YELLOW,1,1,PI / 6,2,1,0.35f,true }; |
|
|
|
|
enemyData[SHOOTME_ARMOR] = { "SHOOTME",enemy_ShootMe,YELLOW,6,1,0.5,2,1,0.3f,true,PowerupType::ARMOR,true }; |
|
|
|
|
enemyData[ISHOOT_MAP] = { "ISHOOT",enemy_IShoot,YELLOW,7,1,0.5,2,2,0.3f,true,PowerupType::MAP,true }; |
|
|
|
|
enemyData[ISHOOT2_SPEED] = { "ISHOOT2",enemy_IShoot2,YELLOW,6,1,PI / 6,2,1,0.35f,true,PowerupType::SPEED,true }; |
|
|
|
|
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} }; |
|
|
|
@ -1496,6 +1498,16 @@ void FaceBall::RenderWorld() { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int FaceBall::PlayerActiveShotCount(int playerNumb){ |
|
|
|
|
int count=0; |
|
|
|
|
for (Bullet&b:bullets){ |
|
|
|
|
if (b.playerIndex==playerNumb){ |
|
|
|
|
count++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return count; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void FaceBall::HandleKeys(float fElapsedTime) { |
|
|
|
|
vec3d vForward = Vector_Mul(vLookDir, std::min(player.GetRadius()-0.00001f,moveSpd*fElapsedTime)); |
|
|
|
|
if (freeRoam) { |
|
|
|
@ -1509,8 +1521,10 @@ void FaceBall::HandleKeys(float fElapsedTime) { |
|
|
|
|
else { |
|
|
|
|
pitch = 0; |
|
|
|
|
if (GetMouse(0).bPressed) { |
|
|
|
|
if (bullets.size() < shotLimit) { |
|
|
|
|
bullets.push_back({ bullet,{player.GetPos().x,player.GetPos().y - 0.15f, player.GetPos().z},fYaw,0.125f,{shotSpd * std::cosf(fYaw),shotSpd * std::sinf(fYaw)},GREEN,true }); |
|
|
|
|
if (PlayerActiveShotCount(0) < shotLimit) { |
|
|
|
|
Bullet newBullet={ bullet,{player.GetPos().x,player.GetPos().y - 0.15f, player.GetPos().z},fYaw,0.125f,{shotSpd * std::cosf(fYaw),shotSpd * std::sinf(fYaw)},GREEN,true }; |
|
|
|
|
newBullet.playerIndex=0; |
|
|
|
|
bullets.push_back(newBullet); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -1742,6 +1756,7 @@ bool FaceBall::OnUserCreate() |
|
|
|
|
exit_wall_tex = new Decal(new Sprite("assets/exitwall.png")); |
|
|
|
|
enemy_ShootMe2_tex = new Decal(new Sprite("assets/enemies/ShootMe2.png")); |
|
|
|
|
enemy_IShoot_tex = new Decal(new Sprite("assets/enemies/IShoot.png")); |
|
|
|
|
enemy_IShoot2_tex = new Decal(new Sprite("assets/enemies/IShoot2.png")); |
|
|
|
|
life4 = new Decal(new Sprite("assets/life4.png")); |
|
|
|
|
life3 = new Decal(new Sprite("assets/life3.png")); |
|
|
|
|
life2 = new Decal(new Sprite("assets/life2.png")); |
|
|
|
@ -1756,6 +1771,7 @@ bool FaceBall::OnUserCreate() |
|
|
|
|
enemy_ShootMe2 = { "assets/enemies/ShootMe2.obj", enemy_ShootMe2_tex }; |
|
|
|
|
enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex }; |
|
|
|
|
enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_tex}; |
|
|
|
|
enemy_IShoot2 = { "assets/enemies/IShoot2.obj", enemy_IShoot2_tex}; |
|
|
|
|
bullet = { "assets/enemies/bullet.obj",bullet_tex }; |
|
|
|
|
powerup = { "assets/Powerup.obj",powerup_tex}; |
|
|
|
|
powerup2 = { "assets/Powerup2.obj",powerup2_tex }; |
|
|
|
@ -1769,7 +1785,7 @@ bool FaceBall::OnUserCreate() |
|
|
|
|
InitializeEnemyData(); |
|
|
|
|
InitializePowerupColors(); |
|
|
|
|
|
|
|
|
|
LoadLevel(1); |
|
|
|
|
LoadLevel(level); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -2203,7 +2219,8 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) { |
|
|
|
|
e.ShootBullet(myIndex); |
|
|
|
|
} |
|
|
|
|
}break; |
|
|
|
|
case ISHOOT2: { |
|
|
|
|
case ISHOOT2: |
|
|
|
|
case ISHOOT2_SPEED:{ |
|
|
|
|
switch (e.GetPhase()) { |
|
|
|
|
case Phase::DEFAULT: { |
|
|
|
|
vf2d movementVec = { std::cosf(e.rot) * dat.movSpd * fElapsedTime,std::sinf(e.rot) * dat.movSpd * fElapsedTime }; |
|
|
|
@ -2526,7 +2543,7 @@ int FaceBall::EnemiesAlive(){ |
|
|
|
|
int main() |
|
|
|
|
{ |
|
|
|
|
FaceBall demo; |
|
|
|
|
if (demo.Construct(1280, 720, 2, 2)) |
|
|
|
|
if (demo.Construct(1280, 720, 2, 2, false, true)) |
|
|
|
|
demo.Start(); |
|
|
|
|
return 0; |
|
|
|
|
} |
|
|
|
|