Skip to content

Commit

Permalink
RC 4.54.323 Working on Boss.
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceJZ committed Nov 27, 2024
1 parent 41c2d78 commit 556f924
Show file tree
Hide file tree
Showing 17 changed files with 89 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Asteroids Reimagined/Enemy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void Enemy::DestinationTarget()
break;
}
}

//TODO: Make it so enemy turns to avoid rocks. Use the path vector if needed.
void Enemy::DestinationTopBottom()
{
if (Player->X() > X())
Expand Down
2 changes: 2 additions & 0 deletions Asteroids Reimagined/Enemy.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ class Enemy : public LineModel
Sound SpawnSound = {};
LineModelPoints ShotModel = {};

std::vector<Vector3> Path = {};

void Shoot();
void Shoot(Vector3 velocity);
void ChasePlayer();
Expand Down
2 changes: 1 addition & 1 deletion Asteroids Reimagined/Enemy1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ void Enemy1::DestinationTarget()

}

void Enemy1::FireMissile() //TODO: Move common parts to Enemy class.
void Enemy1::FireMissile()
{
float missileTimeAmountAdjust = ((float)(Wave - 3) * 0.5f) +
((((float)MissilesFired++)) * 0.05f);
Expand Down
28 changes: 14 additions & 14 deletions Asteroids Reimagined/EnemyControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -702,38 +702,38 @@ void EnemyControl::SpawnBoss()
{
Vector3 position = {0.0f, 0.0f, 0.0f };
float rotation = 0;
float width = Boss->WindowWidth * 0.95f;
float height = Boss->WindowHeight * 0.95f;
float width = Boss->WindowWidth * 0.75f;
float height = Boss->WindowHeight * 0.75f;

int option = GetRandomValue(0, 3);

if (option == 0)
{
position.x = GetRandomFloat(-width, width);
position.y = -Boss->WindowHeight;
position.x = width;
position.y = -height;

rotation = PI / 2.0f;
rotation = -HalfPi;
}
else if (option == 1)
{
position.x = GetRandomFloat(-width, width);
position.y = Boss->WindowHeight;
position.x = -width;
position.y = height;

rotation = PI + PI / 2.0f;
rotation = PI;
}
else if (option == 2)
{
position.x = -Boss->WindowWidth;
position.y = GetRandomFloat(-height, height);
position.x = -width;
position.y = -height;

rotation = 0;
rotation = PI + HalfPi;
}
else if (option == 3)
{
position.x = Boss->WindowWidth;
position.y = GetRandomFloat(-height, height);
position.x = width;
position.y = height;

rotation = PI;
rotation = HalfPi;
}

Boss->Wave = Wave;
Expand Down
5 changes: 5 additions & 0 deletions Asteroids Reimagined/GameLogic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ void GameLogic::FixedUpdate()
if (Player->GetBeenHit())
{
Managers.EM.ResetTimer(ExplodeTimerID);

if (Enemies->Boss->Enabled) Managers.EM.ResetTimer(ExplodeTimerID, 3.0f);

Player->Destroy();

if (Enemies->Boss->Enabled) Enemies->Boss->PlayerHit = true;
}

if (!Player->Enabled && !Player->GetBeenHit() &&
Expand Down
2 changes: 1 addition & 1 deletion Asteroids Reimagined/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ int WinMain()
int windowHeight = 960; //height
int windowWidth = 1280; //width

InitWindow(windowWidth, windowHeight, "Asteroids Reimagined - RC 4.54.223");
InitWindow(windowWidth, windowHeight, "Asteroids Reimagined - RC 4.54.323");
InitAudioDevice();

Image icon = LoadImage("icon.png");
Expand Down
53 changes: 48 additions & 5 deletions Asteroids Reimagined/TheBoss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ bool TheBoss::BeginRun()
LeftSpineMount->Position = { 19.0f * 2.0f, 30.0f * 2.0f, 0.0f };
RightSpineMount->Position = { 19.0f * 2.0f, -30.0f * 2.0f, 0.0f };

float edge = 0.666f;
float edge = 0.7666f;
float upper = WindowHeight * edge;
float lower = -WindowHeight * edge;
float left = -WindowWidth * edge;
Expand Down Expand Up @@ -231,19 +231,27 @@ void TheBoss::Update(float deltaTime)

FireShotAtPlayerArea->Enabled = Enabled;

Vector3 p = Position;

CheckCollisions();
}

void TheBoss::FixedUpdate(float deltaTime)
{
LineModel::FixedUpdate(deltaTime);

if (!Player->GameOver) PlaySound(OnSound);

if (PlayerHit)
{
HeadToEdge();
return;
}

if (AllTurretsDead) ChasePlayer();
else HeadToNextWaypoint();

ReachedWaypoint();

if (!Player->GameOver) PlaySound(OnSound);
}

void TheBoss::Draw3D()
Expand Down Expand Up @@ -301,8 +309,8 @@ void TheBoss::Spawn(Vector3 position, float rotation)
turret->Spawn();
}

Managers.EM.SetTimer(MissileFireTimerID, 2.5f);
Managers.EM.SetTimer(MineDropTimerID, 2.0f);
Managers.EM.SetTimer(MissileFireTimerID, 5.5f);
Managers.EM.SetTimer(MineDropTimerID, 4.0f);
}

void TheBoss::Hit()
Expand Down Expand Up @@ -356,6 +364,41 @@ void TheBoss::ChasePlayer()
SetRotateVelocity(Player->Position, 0.30f, 30.0f);
}

void TheBoss::HeadToEdge()
{
Vector3 edge = { 0.0f, 0.0f, 0.0f };

if (X() > 0.0f)
{
edge.x = WindowWidth * 0.75f;
}
else
{
edge.x = -WindowWidth * 0.75f;
}

if (Y() > 0.0f)
{
edge.y = WindowHeight * 0.75f;
}
else
{
edge.y = -WindowHeight * 0.75f;
}

SetRotateVelocity(edge, 0.60f, 90.0f);

if (Player->Enabled) PlayerHit = false;

Managers.EM.SetTimer(MissileFireTimerID, 5.5f);
Managers.EM.SetTimer(MineDropTimerID, 4.0f);

for (const auto& turret : Turrets)
{
turret->Spawn();
}
}

void TheBoss::ReachedWaypoint()
{
if (CirclesIntersect(Path[NextWaypoint], 10.0f))
Expand Down
2 changes: 2 additions & 0 deletions Asteroids Reimagined/TheBoss.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class TheBoss : public LineModel
TheBoss();
virtual ~TheBoss();

bool PlayerHit = false;
int Wave = 0;

Entity* FireShotAtPlayerArea = nullptr;
Expand Down Expand Up @@ -103,6 +104,7 @@ class TheBoss : public LineModel

void HeadToNextWaypoint();
void ChasePlayer();
void HeadToEdge();
void ReachedWaypoint();
void CheckCollisions();
void FireShots();
Expand Down
2 changes: 1 addition & 1 deletion Asteroids Reimagined/TheBossTurret.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void TheBossTurret::Spawn()
{
Enabled = true;

Managers.EM.ResetTimer(FireTimerID, FireTimerSetting);
Managers.EM.ResetTimer(FireTimerID, FireTimerSetting * 3.5f);
}

void TheBossTurret::Hit()
Expand Down
4 changes: 2 additions & 2 deletions Asteroids Reimagined/ThePlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ void ThePlayer::Hit(Vector3 location, Vector3 velocity)
Particles.SpawnLineDots(Position, Vector3Multiply(Velocity, { 0.15f }),
Radius * 0.25f, 30.0f, 20, 3.5f, WHITE);
Particles.SpawnLineModelExplosion(GetLineModel(), Position, Velocity,
RotationZ, 20.0f, 4.0f, WHITE);
RotationZ, 10.0f, 4.0f, ModelColor);
Particles.SpawnLineModelExplosion(Turret->GetLineModel(), Position, Velocity,
Turret->RotationZ, 15.0f, 3.0f, WHITE);
Turret->RotationZ, 15.0f, 3.0f, Turret->ModelColor);
Acceleration = { 0 };
Velocity = { 0 };
Lives--;
Expand Down
11 changes: 9 additions & 2 deletions Knightmare/LineModelParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,19 @@ void LineModelParticle::Spawn(Vector3 position, Vector3 velocity,

//Change so that the velocity goes out from position.
//The position is the center of the line model that is exploding.
//Add the two points and divide by two to get the middle of the line model.
Vector3 velocityX = GetRandomVelocity(GetRandomFloat(maxSpeed * 0.15f,
maxSpeed * 0.5f));

Vector3 velocityOut = GetVelocityFromAngleZ(rotationZ, maxSpeed * 0.5f);
Vector3 velocityOut = Vector3((GetLineModel().linePoints.at(0).x +
GetLineModel().linePoints.at(1).x) / 2.0f,
(GetLineModel().linePoints.at(0).y +
GetLineModel().linePoints.at(1).y) / 2.0f, 0);

Velocity = (velocity * Vector3(0.1f, 0.1f, 0)) + velocityX + velocityOut;
velocityOut = Vector3Multiply(velocityOut, Vector3(maxSpeed * 0.15f,
maxSpeed * 0.15f, 0));

Velocity = (velocity * Vector3(0.05f, 0.05f, 0)) + velocityX + velocityOut;
RotationZ = rotationZ;
}

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Asteroids Reimagined RC 4.54.223 Released.
Asteroids Reimagined RC 4.54.323 Released.

![Asteroids Reimagined RC 4](https://github.com/user-attachments/assets/d57901d3-3caf-47cb-bf0e-4c03a182b9f0)

Expand Down Expand Up @@ -95,6 +95,8 @@ When Player gets shield Power Up ship turns blue.
Experimental alternate mouse input, use I to switch modes.
Boss Ship has sound now.
Player ship blows up into lines.
Changed Boss ship behavior. Boss turns to edge if player hit. Changed Spawn position.
Improved Player Explosion VFX.

Internal Changes:
Knightmare Engine Update, Made every entity an Entity in Entity Manager.
Expand Down
Binary file modified Release/Asteroids Reimagined Update.zip
Binary file not shown.
Binary file modified Release/Asteroids Reimagined Update/Asteroids Reimagined.exe
Binary file not shown.
Binary file modified Release/Asteroids Reimagined.exe
Binary file not shown.
Binary file modified Release/Asteroids Reimagined.zip
Binary file not shown.
Binary file modified Release/Asteroids Reimagined/Asteroids Reimagined.exe
Binary file not shown.

0 comments on commit 556f924

Please sign in to comment.