Skip to content

Commit

Permalink
Merge pull request #132 from Nine-Byte-Warriors/Corn-Boss
Browse files Browse the repository at this point in the history
Added Boss to the Game
  • Loading branch information
kyle-robinson authored Feb 10, 2023
2 parents e5a7906 + 4edc903 commit 7db2d69
Show file tree
Hide file tree
Showing 9 changed files with 99 additions and 0 deletions.
1 change: 1 addition & 0 deletions Roche-Engine/Events/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ enum class EVENTID
GameEndLevelEvent,
ChangePhase,
NextDay,
FinalNight,
CurrentState,
CurrentPhase,
GetPhase,
Expand Down
3 changes: 3 additions & 0 deletions Roche-Engine/Levels/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ void GameManager::SetPhase()

EventSystem::Instance()->AddEvent(EVENTID::CurrentPhase, &m_currentPhase);

if (m_currentPhase == Phase::NightPhase && m_currentDay == 5)
EventSystem::Instance()->AddEvent(EVENTID::FinalNight);

if (m_currentState == GameState::Unpaused)
EventSystem::Instance()->AddEvent(EVENTID::HUDSwap);

Expand Down
22 changes: 22 additions & 0 deletions Roche-Engine/Levels/Level.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,21 @@ void Level::RenderFrameTileMap()
}
}

void Level::SpawnFinalBoss()
{
int entitynum = m_entityController.GetEntityEnemyNumFromName("Corn");
std::string texture = m_entityController.GetTexture(entitynum);

Vector2f spawnpos = Vector2f(500, 500);
m_entitySpawner.AddEntityToSpawn(entitynum, 0, spawnpos);

m_entitySpawner.SpawnEntity(0);

m_entityController.AddEntityData(m_entitySpawner.GetEntityData()[0]);

m_entitySpawner.EntitiesAdded();
}

void Level::EndFrame_Start()
{
// Render ui
Expand Down Expand Up @@ -751,12 +766,14 @@ void Level::AddToEvent() noexcept
{
EventSystem::Instance()->AddClient(EVENTID::GamePauseEvent, this);
EventSystem::Instance()->AddClient(EVENTID::GameUnpauseEvent, this);
EventSystem::Instance()->AddClient(EVENTID::FinalNight, this);
}

void Level::RemoveFromEvent() noexcept
{
EventSystem::Instance()->RemoveClient(EVENTID::GamePauseEvent, this);
EventSystem::Instance()->RemoveClient(EVENTID::GameUnpauseEvent, this);
EventSystem::Instance()->RemoveClient(EVENTID::FinalNight, this);
}

void Level::HandleEvent(Event* event)
Expand All @@ -773,6 +790,11 @@ void Level::HandleEvent(Event* event)
{
m_bIsGamePaused = false;
}
case EVENTID::FinalNight:
{
SpawnFinalBoss();
break;
}
break;
}
}
2 changes: 2 additions & 0 deletions Roche-Engine/Levels/Level.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ class Level : public LevelContainer, public Listener
void UpdateTileMapEmpty(const float dt);
void RenderFrameTileMap();

void SpawnFinalBoss();

// Objects
Camera m_camera;
UIEditor m_uiEditor;
Expand Down
51 changes: 51 additions & 0 deletions Roche-Engine/Resources/Entity/Entity_Game.json
Original file line number Diff line number Diff line change
Expand Up @@ -661,5 +661,56 @@
"speed": 10.0,
"texture": "Resources\\Textures\\Entity\\Potato\\Potato.png",
"type": "Enemy"
},
{
"AI": true,
"animation": true,
"animationPath": "Resources\\Textures\\Entity\\Corn\\Corn.json",
"animationType": "Walk",
"audio": false,
"bColliderEnabled": true,
"bColliderInteractDecoration": false,
"bColliderInteractEnemy": false,
"bColliderInteractEnemyProjectile": false,
"bColliderInteractPlayer": true,
"bColliderInteractPlayerProjectile": true,
"bColliderStatic": false,
"bColliderTrigger": true,
"bProjectileBullet": true,
"bProjectilePattern": true,
"behaviour": "None",
"collider": true,
"colliderRadius": [
400.0,
500.0
],
"colliderShape": "Box",
"columns": 4,
"health": 5.0,
"identifier": 13,
"mass": 1.0,
"maxFrame": [
1,
1
],
"name": "Corn",
"position": [
418.0,
500.0
],
"projectileBullet": "None",
"projectilePattern": "None",
"projectileSystem": true,
"rotation": 0.0,
"rows": 2,
"sColliderLayer": "Enemy",
"scale": [
400.0,
500.0
],
"soundBankName": "",
"speed": 10.0,
"texture": "Resources\\Textures\\Entity\\Corn\\Corn Boss.png",
"type": "Enemy"
}
]

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions Roche-Engine/Resources/Textures/Entity/Corn/Corn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"frameCount": [
4,
1
],
"name": "Corn",
"type": [
{
"alias": "Corn Running",
"frameTiming": 0.5,
"name": "Walk"
},
{
"alias": " Corn getting hit",
"frameTiming": 1.0,
"name": "Hit"
}
]
}

0 comments on commit 7db2d69

Please sign in to comment.