Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature 3 level progression #6

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion Array-Jumper/Array-Jumper.vcxproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
Expand Down Expand Up @@ -133,14 +133,26 @@
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="source\GamePlay\GamePlayController.cpp" />
<ClCompile Include="source\GamePlay\GamePlayService.cpp" />
<ClCompile Include="source\Global\Config.cpp" />
<ClCompile Include="source\Event\EventService.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="source\Global\ServiceLocator.cpp" />
<ClCompile Include="source\Level\LevelController.cpp" />
<ClCompile Include="source\Level\LevelModel.cpp" />
<ClCompile Include="source\Level\LevelService.cpp" />
<ClCompile Include="source\Level\LevelView.cpp" />
<ClCompile Include="source\Player\PlayerController.cpp" />
<ClCompile Include="source\Player\PlayerModel.cpp" />
<ClCompile Include="source\Player\PlayerService.cpp" />
<ClCompile Include="source\Player\PlayerView.cpp" />
<ClCompile Include="source\Sound\SoundService.cpp" />
<ClCompile Include="source\Main\GameService.cpp" />
<ClCompile Include="source\Graphics\GraphicService.cpp" />
<ClCompile Include="source\UI\Credits\CreditsScreenUIController.cpp" />
<ClCompile Include="source\UI\GameOver\GameOverController.cpp" />
<ClCompile Include="source\UI\GamePlay\GameplayUIController.cpp" />
<ClCompile Include="source\UI\Instructions\InstructionsUIController.cpp" />
<ClCompile Include="source\UI\MainMenu\MainMenuUIController.cpp" />
<ClCompile Include="source\UI\SplashScreen\SplashScreenUIController.cpp" />
Expand All @@ -152,12 +164,28 @@
<ClCompile Include="source\UI\UIService.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="header\GamePlay\GamePlayController.h" />
<ClInclude Include="header\GamePlay\GamePlayService.h" />
<ClInclude Include="header\Global\Config.h" />
<ClInclude Include="header\Event\EventService.h" />
<ClInclude Include="header\Level\BlockType.h" />
<ClInclude Include="header\Level\LevelConfiguration.h" />
<ClInclude Include="header\Level\LevelController.h" />
<ClInclude Include="header\Level\LevelData.h" />
<ClInclude Include="header\Level\LevelModel.h" />
<ClInclude Include="header\Level\LevelService.h" />
<ClInclude Include="header\Level\LevelView.h" />
<ClInclude Include="header\Player\Movement.h" />
<ClInclude Include="header\Player\PlayerController.h" />
<ClInclude Include="header\Player\PlayerModel.h" />
<ClInclude Include="header\Player\PlayerService.h" />
<ClInclude Include="header\Player\PlayerView.h" />
<ClInclude Include="header\Sound\SoundService.h" />
<ClInclude Include="header\Main\GameService.h" />
<ClInclude Include="header\Graphics\GraphicService.h" />
<ClInclude Include="header\UI\Credits\CreditsScreenUIController.h" />
<ClInclude Include="header\UI\GameOver\GameOverController.h" />
<ClInclude Include="header\UI\GamePlay\GameplayUIController.h" />
<ClInclude Include="header\UI\Instructions\InstructionsUIController.h" />
<ClInclude Include="header\UI\MainMenu\MainMenuUIController.h" />
<ClInclude Include="header\UI\SplashScreen\SplashScreenUIController.h" />
Expand Down
25 changes: 25 additions & 0 deletions Array-Jumper/Array-Jumper.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
<ClCompile Include="source\UI\UIElement\ImageView.cpp" />
<ClCompile Include="source\UI\UIElement\TextView.cpp" />
<ClCompile Include="source\UI\UIElement\UIView.cpp" />
<ClCompile Include="source\Player\PlayerModel.cpp" />
<ClCompile Include="source\Player\PlayerView.cpp" />
<ClCompile Include="source\Player\PlayerController.cpp" />
<ClCompile Include="source\Player\PlayerService.cpp" />
<ClCompile Include="source\Level\LevelModel.cpp" />
<ClCompile Include="source\Level\LevelView.cpp" />
<ClCompile Include="source\Level\LevelController.cpp" />
<ClCompile Include="source\Level\LevelService.cpp" />
<ClCompile Include="source\GamePlay\GamePlayService.cpp" />
<ClCompile Include="source\GamePlay\GamePlayController.cpp" />
<ClCompile Include="source\UI\GamePlay\GameplayUIController.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="header\Main\GameService.h">
Expand Down Expand Up @@ -74,6 +85,20 @@
<ClInclude Include="header\UI\UIElement\ImageView.h" />
<ClInclude Include="header\UI\UIElement\TextView.h" />
<ClInclude Include="header\UI\UIElement\UIView.h" />
<ClInclude Include="header\Player\PlayerModel.h" />
<ClInclude Include="header\Player\PlayerView.h" />
<ClInclude Include="header\Player\PlayerController.h" />
<ClInclude Include="header\Player\PlayerService.h" />
<ClInclude Include="header\Level\LevelModel.h" />
<ClInclude Include="header\Level\LevelController.h" />
<ClInclude Include="header\Level\LevelView.h" />
<ClInclude Include="header\Level\LevelService.h" />
<ClInclude Include="header\Level\BlockType.h" />
<ClInclude Include="header\Level\LevelData.h" />
<ClInclude Include="header\Player\Movement.h" />
<ClInclude Include="header\GamePlay\GamePlayController.h" />
<ClInclude Include="header\GamePlay\GamePlayService.h" />
<ClInclude Include="header\UI\GamePlay\GameplayUIController.h" />
</ItemGroup>
<ItemGroup>
<Media Include="assets\sounds\background_music.mp3" />
Expand Down
31 changes: 31 additions & 0 deletions Array-Jumper/header/GamePlay/GamePlayController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once
#include "../../header/Level/BlockType.h"

namespace GamePlay
{

class GamePlayController
{
public:
GamePlayController();
~GamePlayController();

void initialize();
void update();
void render();
void onDeath();
void gameWon();
void loadNextLevel();
bool isLastLevel();

private:
void processObstacle();
bool isCollidingWithObstacle(BlockType value);
void onPositionChanged(int position);
bool isEndBlock(BlockType value);
void processEndBlock();
void gameOver();
};


}
25 changes: 25 additions & 0 deletions Array-Jumper/header/GamePlay/GamePlayService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#pragma once
namespace GamePlay
{
class GamePlayController;
class GamePlayService
{
public:
GamePlayService();
~GamePlayService();


void initialize();
void update();
void render();

void onDeath();


private:
GamePlayController* m_gamePlayController;
};



}
9 changes: 9 additions & 0 deletions Array-Jumper/header/Global/ServiceLocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#include "../../header/Event/EventService.h"
#include "../../header/UI/UIService.h"
#include "../../header/Sound/SoundService.h"
#include "../../header/Player/PlayerService.h"
#include "../../header/Level/LevelService.h"
#include "../../header/GamePlay/GamePlayService.h"

namespace Global
{
Expand All @@ -13,6 +16,9 @@ namespace Global
Event::EventService* event_service;
Sound::SoundService* sound_service;
UI::UIService* ui_service;
Player::PlayerService* player_service;
Level::LevelService* level_service;
GamePlay::GamePlayService* game_play_service;

~ServiceLocator();

Expand All @@ -31,5 +37,8 @@ namespace Global
Event::EventService* getEventService();
Sound::SoundService* getSoundService();
UI::UIService* getUIService();
Player::PlayerService* getPlayerService();
Level::LevelService* getLevelService();
GamePlay::GamePlayService* getGamePlayService();
};
}
11 changes: 11 additions & 0 deletions Array-Jumper/header/Level/BlockType.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#pragma once

enum class BlockType
{
OBSTACLE_ONE = -1,
OBSTACLE_TWO = -2,
TARGET = 0,
ONE = 1,
TWO = 2,
THREE = 3,
};
45 changes: 45 additions & 0 deletions Array-Jumper/header/Level/LevelConfiguration.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#pragma once
#include "../../header/Level/BlockType.h"
#include "../../header/Level/LevelData.h"

namespace Level
{
class LevelConfiguration
{
public:
static const int number_of_levels = 3;
LevelData levels[number_of_levels];
LevelConfiguration() {

for (int i = 0; i < LevelData::number_of_box; i++)
{
levels[0].level_boxes[i] = level_1[i];
}

for (int i = 0; i < LevelData::number_of_box; i++)
{
levels[1].level_boxes[i] = level_2[i];
}
for (int i = 0; i < LevelData::number_of_box; i++)
{
levels[2].level_boxes[i] = level_3[i];
}
};

private:
BlockType level_1[LevelData::number_of_box] =
{
BlockType::ONE, BlockType::TWO, BlockType::OBSTACLE_ONE, BlockType::TWO, BlockType::THREE, BlockType::ONE, BlockType::OBSTACLE_TWO, BlockType::TWO, BlockType::ONE, BlockType::TARGET
};

BlockType level_2[LevelData::number_of_box] =
{
BlockType::ONE, BlockType::TWO, BlockType::OBSTACLE_TWO, BlockType::ONE, BlockType::TWO, BlockType::OBSTACLE_ONE, BlockType::THREE, BlockType::OBSTACLE_ONE, BlockType::ONE, BlockType::TARGET
};

BlockType level_3[LevelData::number_of_box] =
{
BlockType::ONE, BlockType::THREE, BlockType::OBSTACLE_ONE, BlockType::OBSTACLE_TWO, BlockType::ONE, BlockType::TWO, BlockType::OBSTACLE_ONE, BlockType::TWO, BlockType::ONE, BlockType::TARGET
};
};
}
29 changes: 29 additions & 0 deletions Array-Jumper/header/Level/LevelController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once
#include "BlockType.h"
#include "../../header/Level/LevelModel.h"
namespace Level
{
class LevelModel;
class LevelView;
class LevelController
{
public:
LevelController();
~LevelController();

void initialize();
void update();
void render();

BlockType getCurrentBoxValue(int currenPosition);
BoxDimension getBoxDimension();
bool isLastLevel();
void nextLevel();
int getCurrentLevelIndex();
void reset();

private:
LevelModel* level_model;
LevelView* level_view;
};
}
15 changes: 15 additions & 0 deletions Array-Jumper/header/Level/LevelData.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include "../../header/Level/BlockType.h"

namespace Level
{
struct LevelData
{
static const int number_of_box = 10;
BlockType level_boxes[number_of_box];



};
}

35 changes: 35 additions & 0 deletions Array-Jumper/header/Level/LevelModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once
#include "../../header/Level/LevelData.h"
#include "../../header/Level/LevelConfiguration.h"
namespace Level
{
struct BoxDimension
{
float box_width;
float box_height;

float box_spacing;

float box_spacing_percentage = 0.3f;
float bottom_offset = 200.f;

};
class LevelModel
{
public:
LevelModel();
~LevelModel();

BlockType getCurrentBoxValue(int currentPosition);
void nextLevel();
int getCurrentLevelIndex();
bool isLastLevel();
void reset();

private:
int current_level_index = 0;
LevelConfiguration level_configuration;
};


}
29 changes: 29 additions & 0 deletions Array-Jumper/header/Level/LevelService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once
#include "BlockType.h"
namespace Level
{
struct BoxDimension;
class LevelController;
class BoxType;
class LevelService
{
public:
LevelService();
~LevelService();

void initialize();
void update();
void render();

BoxDimension getBoxDimension();
BlockType getCurrentBoxValue(int currentPosition);
bool isLastLevel();
void nextLevel();
int getCurrentLevelIndex();
void reset();

private:
LevelController* level_controller;
};

}
Loading