Update and implement IShoot2 model and fix up bullet counting bug.
This commit is contained in:
parent
f2e66c064e
commit
fa21aea202
@ -295,7 +295,8 @@ void Editor::OnTextEntryComplete(const std::string& sText) {
|
|||||||
MAP_SIZE = { (int)map[0].size(),(int)map.size() };
|
MAP_SIZE = { (int)map[0].size(),(int)map.size() };
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
reEnableTextEntry = true;
|
game->TextEntryEnable(false);
|
||||||
|
promptState = PromptState::NONE;
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case PromptState::ENTER_WIDTH: {
|
case PromptState::ENTER_WIDTH: {
|
||||||
|
@ -28,6 +28,7 @@ enum EnemyID {
|
|||||||
ISHOOT2,
|
ISHOOT2,
|
||||||
SHOOTME_ARMOR,
|
SHOOTME_ARMOR,
|
||||||
ISHOOT_MAP,
|
ISHOOT_MAP,
|
||||||
|
ISHOOT2_SPEED,
|
||||||
SONAR,
|
SONAR,
|
||||||
POWERUP_ARMOR = 56,
|
POWERUP_ARMOR = 56,
|
||||||
POWERUP_SPEED = 57,
|
POWERUP_SPEED = 57,
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
@ -1,27 +1,51 @@
|
|||||||
5
|
7
|
||||||
5
|
7
|
||||||
8192
|
17193
|
||||||
8192
|
8202
|
||||||
8192
|
24586
|
||||||
8192
|
424
|
||||||
8192
|
8202
|
||||||
8192
|
25370
|
||||||
8192
|
16924
|
||||||
8192
|
1221
|
||||||
8192
|
8201
|
||||||
8192
|
8204
|
||||||
8192
|
8597
|
||||||
8192
|
8201
|
||||||
8192
|
8204
|
||||||
8192
|
17221
|
||||||
8192
|
8197
|
||||||
8192
|
8195
|
||||||
8192
|
8198
|
||||||
8192
|
837
|
||||||
8192
|
24579
|
||||||
8192
|
8198
|
||||||
8192
|
837
|
||||||
8192
|
8721
|
||||||
8192
|
8202
|
||||||
8192
|
8202
|
||||||
8192
|
8192
|
||||||
|
8202
|
||||||
|
8202
|
||||||
|
25444
|
||||||
|
8197
|
||||||
|
11
|
||||||
|
8204
|
||||||
|
24581
|
||||||
|
9
|
||||||
|
8204
|
||||||
|
8197
|
||||||
|
8197
|
||||||
|
8351
|
||||||
|
8199
|
||||||
|
25381
|
||||||
|
8195
|
||||||
|
8198
|
||||||
|
8197
|
||||||
|
9027
|
||||||
|
24986
|
||||||
|
8202
|
||||||
|
8194
|
||||||
|
8746
|
||||||
|
24586
|
||||||
|
278
|
||||||
|
@ -264,8 +264,10 @@ void FaceBall::InitializeEnemyData() {
|
|||||||
enemyData[SHOOTME] = { "SHOOTME",enemy_ShootMe,YELLOW,1,1,0.5,2,1,0.2f,true };
|
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[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[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[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[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[SONAR] = { "Sonar",enemy_Sonar,RED,5,1,PI / 8,2,1 };
|
||||||
enemyData[COIN] = { "Coin",undefined,BLUE };
|
enemyData[COIN] = { "Coin",undefined,BLUE };
|
||||||
enemyData[POWERUP_ARMOR] = { "Armor",undefined,{96,0,96} };
|
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) {
|
void FaceBall::HandleKeys(float fElapsedTime) {
|
||||||
vec3d vForward = Vector_Mul(vLookDir, std::min(player.GetRadius()-0.00001f,moveSpd*fElapsedTime));
|
vec3d vForward = Vector_Mul(vLookDir, std::min(player.GetRadius()-0.00001f,moveSpd*fElapsedTime));
|
||||||
if (freeRoam) {
|
if (freeRoam) {
|
||||||
@ -1509,8 +1521,10 @@ void FaceBall::HandleKeys(float fElapsedTime) {
|
|||||||
else {
|
else {
|
||||||
pitch = 0;
|
pitch = 0;
|
||||||
if (GetMouse(0).bPressed) {
|
if (GetMouse(0).bPressed) {
|
||||||
if (bullets.size() < shotLimit) {
|
if (PlayerActiveShotCount(0) < 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 });
|
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"));
|
exit_wall_tex = new Decal(new Sprite("assets/exitwall.png"));
|
||||||
enemy_ShootMe2_tex = new Decal(new Sprite("assets/enemies/ShootMe2.png"));
|
enemy_ShootMe2_tex = new Decal(new Sprite("assets/enemies/ShootMe2.png"));
|
||||||
enemy_IShoot_tex = new Decal(new Sprite("assets/enemies/IShoot.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"));
|
life4 = new Decal(new Sprite("assets/life4.png"));
|
||||||
life3 = new Decal(new Sprite("assets/life3.png"));
|
life3 = new Decal(new Sprite("assets/life3.png"));
|
||||||
life2 = new Decal(new Sprite("assets/life2.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_ShootMe2 = { "assets/enemies/ShootMe2.obj", enemy_ShootMe2_tex };
|
||||||
enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex };
|
enemy_Sonar = { "assets/enemies/Sonar.obj", enemy_Sonar_tex };
|
||||||
enemy_IShoot = { "assets/enemies/IShoot.obj", enemy_IShoot_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 };
|
bullet = { "assets/enemies/bullet.obj",bullet_tex };
|
||||||
powerup = { "assets/Powerup.obj",powerup_tex};
|
powerup = { "assets/Powerup.obj",powerup_tex};
|
||||||
powerup2 = { "assets/Powerup2.obj",powerup2_tex };
|
powerup2 = { "assets/Powerup2.obj",powerup2_tex };
|
||||||
@ -1769,7 +1785,7 @@ bool FaceBall::OnUserCreate()
|
|||||||
InitializeEnemyData();
|
InitializeEnemyData();
|
||||||
InitializePowerupColors();
|
InitializePowerupColors();
|
||||||
|
|
||||||
LoadLevel(1);
|
LoadLevel(level);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2203,7 +2219,8 @@ void FaceBall::RunEnemyAI(Enemy& e,float fElapsedTime,int myIndex) {
|
|||||||
e.ShootBullet(myIndex);
|
e.ShootBullet(myIndex);
|
||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case ISHOOT2: {
|
case ISHOOT2:
|
||||||
|
case ISHOOT2_SPEED:{
|
||||||
switch (e.GetPhase()) {
|
switch (e.GetPhase()) {
|
||||||
case Phase::DEFAULT: {
|
case Phase::DEFAULT: {
|
||||||
vf2d movementVec = { std::cosf(e.rot) * dat.movSpd * fElapsedTime,std::sinf(e.rot) * dat.movSpd * fElapsedTime };
|
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()
|
int main()
|
||||||
{
|
{
|
||||||
FaceBall demo;
|
FaceBall demo;
|
||||||
if (demo.Construct(1280, 720, 2, 2))
|
if (demo.Construct(1280, 720, 2, 2, false, true))
|
||||||
demo.Start();
|
demo.Start();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -153,6 +153,7 @@ struct Bullet : Object{
|
|||||||
EnemyID shooterID;
|
EnemyID shooterID;
|
||||||
int shooterIndex = -1;
|
int shooterIndex = -1;
|
||||||
bool shooterBlinking = false;
|
bool shooterBlinking = false;
|
||||||
|
int playerIndex = -1;
|
||||||
bool Update(float fElapsedTime);
|
bool Update(float fElapsedTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -262,7 +263,7 @@ class FaceBall : public PixelGameEngine
|
|||||||
private:
|
private:
|
||||||
Mesh mapWalls,mapFloor,enemy_ShootMe,undefined,
|
Mesh mapWalls,mapFloor,enemy_ShootMe,undefined,
|
||||||
enemy_Sonar, mapExit,enemy_ShootMe2,powerup,powerup2,
|
enemy_Sonar, mapExit,enemy_ShootMe2,powerup,powerup2,
|
||||||
enemy_IShoot;
|
enemy_IShoot,enemy_IShoot2;
|
||||||
|
|
||||||
Sprite*mapSpr;
|
Sprite*mapSpr;
|
||||||
Decal*mapDecal;
|
Decal*mapDecal;
|
||||||
@ -272,7 +273,7 @@ class FaceBall : public PixelGameEngine
|
|||||||
Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex,
|
Decal* dot, * enemy_ShootMe_tex,*bullet_tex,*wall_tex,*floor_tex,
|
||||||
*enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_ShootMe2_tex,*enemy_IShoot_tex,
|
*enemy_Sonar_tex,*hud,*exit_wall_tex,*enemy_ShootMe2_tex,*enemy_IShoot_tex,
|
||||||
*life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex,
|
*life4,*life3,*life2,*life1,*crosshair,*hudmeter,*powerup_tex,*powerup2_tex,
|
||||||
*powerups_tex;
|
*powerups_tex,*enemy_IShoot2_tex;
|
||||||
vi2d exitCoords = { 0,0 };
|
vi2d exitCoords = { 0,0 };
|
||||||
std::vector<vf2d>knownGoodPositions;
|
std::vector<vf2d>knownGoodPositions;
|
||||||
std::vector<std::vector<MapSquare>>map;
|
std::vector<std::vector<MapSquare>>map;
|
||||||
@ -281,7 +282,7 @@ class FaceBall : public PixelGameEngine
|
|||||||
Editor editor;
|
Editor editor;
|
||||||
int MapWallsObjectIndex = -1;
|
int MapWallsObjectIndex = -1;
|
||||||
bool exitWallsCleared = false;
|
bool exitWallsCleared = false;
|
||||||
int level=1;
|
int level=3;
|
||||||
int tagsRemaining = 10;
|
int tagsRemaining = 10;
|
||||||
int lives = 3;
|
int lives = 3;
|
||||||
double gameTimer = 0;
|
double gameTimer = 0;
|
||||||
@ -421,6 +422,7 @@ public:
|
|||||||
int CheckPowerupCollision(vec3d movementVector, vf2d pos, float radius);
|
int CheckPowerupCollision(vec3d movementVector, vf2d pos, float radius);
|
||||||
void ResetScore();
|
void ResetScore();
|
||||||
int EnemiesAlive();
|
int EnemiesAlive();
|
||||||
|
int PlayerActiveShotCount(int playerNumb);
|
||||||
public:
|
public:
|
||||||
vi2d MAP_SIZE;
|
vi2d MAP_SIZE;
|
||||||
float restingTriangleYDepth = 0.f;
|
float restingTriangleYDepth = 0.f;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user