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 8 powerups #123

Open
wants to merge 51 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
93f3e44
Added my own window file
Alcatraz714 Jul 28, 2024
676acb2
Added new Main.cpp
Alcatraz714 Jul 29, 2024
fe06d7c
Shapes added
Alcatraz714 Jul 29, 2024
a096bda
Logo and Sprites
Alcatraz714 Jul 29, 2024
fcc675e
added text and sprites
Alcatraz714 Jul 29, 2024
f3f7ec0
Merge pull request #1 from Alcatraz714/Feature-1-SFML
Alcatraz714 Jul 29, 2024
9b096bb
OOP
Alcatraz714 Jul 29, 2024
1116b79
Added keyboard inputs and getters and setters
Alcatraz714 Jul 29, 2024
f7c02e3
Added move functions
Alcatraz714 Jul 29, 2024
45ea812
Added Header and Source folders with GameService
Alcatraz714 Jul 30, 2024
e527f50
comments and gameloop code shift
Alcatraz714 Jul 30, 2024
5fe3d91
Merge pull request #2 from Alcatraz714/Feature-2-OOP
Alcatraz714 Jul 30, 2024
a5529a7
Added Service Locator header and cpp
Alcatraz714 Jul 30, 2024
067493a
Merge pull request #3 from Alcatraz714/Feature-2-OOP
Alcatraz714 Jul 30, 2024
9c1cd5a
Changed Architecture and added links between units
Alcatraz714 Jul 30, 2024
88e545b
Merge pull request #4 from Alcatraz714/Feature-2-OOP
Alcatraz714 Jul 30, 2024
452befa
added event service header and cpp
Alcatraz714 Jul 30, 2024
c2b5ccf
Merge pull request #5 from Alcatraz714/Feature-2-OOP
Alcatraz714 Jul 30, 2024
abdf09b
Added Player Service Header and cpp
Alcatraz714 Jul 31, 2024
e759f6e
Added time Service
Alcatraz714 Jul 31, 2024
974eae8
Merge pull request #6 from Alcatraz714/Feature-3-Player-Ship
Alcatraz714 Jul 31, 2024
943dfd9
Split the player into 3 different units
Alcatraz714 Jul 31, 2024
63c6c72
Merge pull request #7 from Alcatraz714/Feature-3-Player-Ship
Alcatraz714 Jul 31, 2024
e01b88b
Added code to player units
Alcatraz714 Jul 31, 2024
c642815
Merge pull request #8 from Alcatraz714/Feature-3-Player-Ship
Alcatraz714 Jul 31, 2024
621747d
Delete Space-Invaders/Header directory
Alcatraz714 Aug 1, 2024
4339484
Delete Space-Invaders/Source directory
Alcatraz714 Aug 1, 2024
8df483d
Delete Space-Invaders/main.cpp
Alcatraz714 Aug 1, 2024
f01bc02
Delete Space-Invaders/Space-Invaders.sln
Alcatraz714 Aug 1, 2024
5844287
New Feature 3 Arch branch
Alcatraz714 Aug 1, 2024
58622f5
Delete Space-Invaders/Header directory
Alcatraz714 Aug 1, 2024
4f64943
Delete Space-Invaders/Source directory
Alcatraz714 Aug 1, 2024
97ebea3
Merge pull request #10 from Alcatraz714/Feature-3-Player-Ship
Alcatraz714 Aug 1, 2024
2f3005b
Added Namespaces
Alcatraz714 Aug 1, 2024
ff152f2
Game State added
Alcatraz714 Aug 2, 2024
6601dac
Added Main Menu and lifecycle
Alcatraz714 Aug 2, 2024
50e219c
Added new control functions
Alcatraz714 Aug 2, 2024
35c51f6
Added EnemyService
Alcatraz714 Aug 4, 2024
f515f61
Added movement
Alcatraz714 Aug 4, 2024
fb6f2c4
fixed move and multiple enemies
Alcatraz714 Aug 4, 2024
c2cf915
Added Gameplay Services
Alcatraz714 Aug 4, 2024
f3b7383
Enemy Config
Alcatraz714 Aug 6, 2024
39fdfbe
Added Zapper and Sub Zero
Alcatraz714 Aug 6, 2024
e448b2c
Added Element folder MVC
Alcatraz714 Aug 6, 2024
446a3a0
MVC and Bunker
Alcatraz714 Aug 7, 2024
9d4ba43
Added Config
Alcatraz714 Aug 7, 2024
b92bb21
Added Sound Playback
Alcatraz714 Aug 7, 2024
56f32a4
Added Bullet folder and interface
Alcatraz714 Aug 8, 2024
37a6b31
FireBullet Added
Alcatraz714 Aug 8, 2024
2d6b1fb
Merge pull request #11 from Alcatraz714/Feature-7-Bullets
Alcatraz714 Aug 9, 2024
547651c
Added ICollectible
Alcatraz714 Aug 9, 2024
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
16 changes: 16 additions & 0 deletions Space-Invaders/Header/Bullet/BulletConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once
namespace Bullet
{
enum class BulletType
{
LASER_BULLET,
TORPEDO,
FROST_BULLET,
};

enum class MovementDirection
{
UP, //player needs to shoot in upward direction
DOWN, // enemies always shoot in downward direction
};
}
35 changes: 35 additions & 0 deletions Space-Invaders/Header/Bullet/BulletController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once
#include "../../Header/Projectile/IProjectile.h"
#include "../../Header/Bullet/BulletConfig.h"

namespace Bullet
{
class BulletView;
class BulletModel;
enum class BulletType;

class BulletController : public Projectile::IProjectile
{
protected:

BulletView* bullet_view;
BulletModel* bullet_model;

void updateProjectilePosition() override;

void moveUp();
void moveDown();
void handleOutOfBounds();

public:

BulletController(BulletType type);
virtual ~BulletController() override;
void initialize(sf::Vector2f position, Bullet::MovementDirection direction) override;
void update() override;
void render() override;

sf::Vector2f getProjectilePosition() override;
BulletType getBulletType();
};
}
37 changes: 37 additions & 0 deletions Space-Invaders/Header/Bullet/BulletModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once
#include <SFML/Graphics.hpp>

namespace Bullet
{
enum class BulletType;
enum class MovementDirection;

class BulletModel
{
private:
float movement_speed = 300.f;
sf::Vector2f bullet_position;

BulletType bullet_type;
MovementDirection movement_direction;

public:

BulletModel(BulletType type);
~BulletModel();

void initialize(sf::Vector2f position, MovementDirection direction);

sf::Vector2f getBulletPosition();
void setBulletPosition(sf::Vector2f position);

BulletType getBulletType();
void setBulletType(BulletType type);

MovementDirection getMovementDirection();
void setMovementDirection(MovementDirection direction);

float getMovementSpeed();
void setMovementSpeed(float speed);
};
}
32 changes: 32 additions & 0 deletions Space-Invaders/Header/Bullet/BulletService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once
#include <vector>
#include "SFML/System/Vector2.hpp"
#include "../../Header/Projectile/IProjectile.h"

namespace Bullet
{
class BulletController;
enum class BulletType;
enum class MovementDirection;

class BulletService
{
private:

std::vector<Projectile::IProjectile*> bullet_list;

BulletController* createBullet(BulletType bullet_type);
void destroy();

public:
BulletService();
virtual ~BulletService();

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

BulletController* spawnBullet(BulletType bullet_type, sf::Vector2f position, MovementDirection direction);
void destroyBullet(BulletController* bullet_controller);
};
}
33 changes: 33 additions & 0 deletions Space-Invaders/Header/Bullet/BulletView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "../../Header/Bullet/BulletController.h"

namespace Bullet
{
class BulletController;
enum class BulletType;

class BulletView
{
private:
const float bullet_sprite_width = 18.f;
const float bullet_sprite_height = 18.f;

sf::RenderWindow* game_window;
sf::Texture bullet_texture;
sf::Sprite bullet_sprite;

BulletController* bullet_controller;

void initializeImage(BulletType type);
void scaleImage();

public:
BulletView();
~BulletView();

void initialize(BulletController* controller);
void update();
void render();
};
}
20 changes: 20 additions & 0 deletions Space-Invaders/Header/Bullet/Controllers/FrostBulletController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include "../../Header/Bullet/BulletController.h"

namespace Bullet
{
namespace Controller
{
class FrostBulletController : public BulletController
{
private:
const float torpedo_movement_speed = 500.f;

public:
FrostBulletController(BulletType type);
~FrostBulletController();

void initialize(sf::Vector2f position, MovementDirection direction) override;
};
}
}
17 changes: 17 additions & 0 deletions Space-Invaders/Header/Bullet/Controllers/LaserBulletController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include "../../Header/Bullet/BulletController.h"

namespace Bullet
{
namespace Controller
{
class LaserBulletController : public BulletController
{
public:
LaserBulletController(BulletType type);
~LaserBulletController();

void initialize(sf::Vector2f position, MovementDirection direction) override;
};
}
}
20 changes: 20 additions & 0 deletions Space-Invaders/Header/Bullet/Controllers/TorpedoController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include "../../Header/Bullet/BulletController.h"

namespace Bullet
{
namespace Controller
{
class TorpedoController : public BulletController
{
private:
const float torpedo_movement_speed = 200.f;

public:
TorpedoController(BulletType type);
~TorpedoController();

void initialize(sf::Vector2f position, MovementDirection direction) override;
};
}
}
17 changes: 17 additions & 0 deletions Space-Invaders/Header/Collectible/ICollectible.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include <SFML/System/Vector2.hpp>

namespace Collectible
{
class ICollectible
{
public:
virtual void onCollected() = 0;
virtual void initialize(sf::Vector2f position) = 0;
virtual void update() = 0;
virtual void render() = 0;
virtual sf::Vector2f getCollectiblePosition() = 0;

virtual ~ICollectible() {};
};
}
28 changes: 28 additions & 0 deletions Space-Invaders/Header/Element/Bunker/BunkerController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "../../header/Element/Bunker/BunkerModel.h"

namespace Element
{
namespace Bunker
{
class BunkerView;

class BunkerController
{
private:
BunkerView* bunker_view;
BunkerData bunker_data;

public:
BunkerController();
~BunkerController();

void initialize(BunkerData data);
void update();
void render();

sf::Vector2f getBunkerPosition();
};
}
}
15 changes: 15 additions & 0 deletions Space-Invaders/Header/Element/Bunker/BunkerModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include <SFML/System/Vector2.hpp>

namespace Element
{
namespace Bunker
{
struct BunkerData
{
sf::Vector2f position;
BunkerData();
BunkerData(sf::Vector2f position);
};
}
}
36 changes: 36 additions & 0 deletions Space-Invaders/Header/Element/Bunker/BunkerView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once
#include <SFML/Graphics.hpp>

namespace Element
{
namespace Bunker
{
class BunkerController;

class BunkerView
{
private:
const float bunker_sprite_width = 80.f;
const float bunker_sprite_height = 80.f;

BunkerController* bunker_controller;
sf::RenderWindow* game_window;

sf::Texture bunker_texture;
sf::Sprite bunker_sprite;

//const sf::String bunker_texture_path = "assets/textures/bunker.png";

void scaleSprite();
void initializeImage();

public:
BunkerView();
~BunkerView();

void initialize(BunkerController* controller);
void update();
void render();
};
}
}
34 changes: 34 additions & 0 deletions Space-Invaders/Header/Element/ElementService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once
#include <vector>
#include <SFML/System/Vector2.hpp>
#include "../../header/Element/Bunker/BunkerController.h"
#include "../../header/Element/Bunker/BunkerModel.h"

namespace Element
{
class BunkerController;

class ElementService
{
private:
//const vector so that the default values will not be changed down the road by mistake.
const std::vector<Bunker::BunkerData> bunker_data_list = { Bunker::BunkerData(sf::Vector2f(130.f, 800.f)),
Bunker::BunkerData(sf::Vector2f(430.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(730.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(1130.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(1430.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(1730.0f, 800.f)) };

std::vector<Bunker::BunkerController*> bunker_list;

void destroy();

public:
ElementService();
virtual ~ElementService();

void initialize();
void update();
void render();
};
}
30 changes: 30 additions & 0 deletions Space-Invaders/Header/Enemy/Controllers/SubZeroController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "../../header/Enemy/EnemyController.h"

namespace Enemy
{
namespace Controller
{
class SubzeroController : public EnemyController
{
private:

float vertical_movement_speed = 100.f;
const float subzero_rate_of_fire = 2.f;

void move() override;
void moveDown();

void fireBullet() override;

public:

SubzeroController(EnemyType type);
~SubzeroController();

void initialize() override;

};
}
}
Loading