Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8110600
recreated branch
abhi6403 Jul 26, 2024
8eaa7c8
Fetching mouse inputs
abhi6403 Jul 26, 2024
2255833
Manage button state
abhi6403 Jul 26, 2024
c26fb9a
A and D movement
abhi6403 Jul 27, 2024
26637f2
Implement Enemy Service
abhi6403 Jul 27, 2024
e05646e
Implement Enemy Movement
abhi6403 Jul 27, 2024
842bebe
spawn Enemies
abhi6403 Jul 27, 2024
0e3de50
Gameplay Service
abhi6403 Jul 27, 2024
12c35c7
Common Enemy properties
abhi6403 Aug 1, 2024
3234177
Creating pure virtual function
abhi6403 Aug 1, 2024
ed2897c
movement function
abhi6403 Aug 3, 2024
4ca29a7
spawn Enemies
abhi6403 Aug 5, 2024
03043b9
Create Barriers
abhi6403 Aug 5, 2024
eb8040f
Data for Barriers
abhi6403 Aug 5, 2024
a660a6d
Spawn Multiple Barriers
abhi6403 Aug 5, 2024
4af6b37
Create Config
abhi6403 Aug 5, 2024
be2e7af
Create Sound Service
abhi6403 Aug 5, 2024
603a77d
Playing Sounds
abhi6403 Aug 5, 2024
5ac409c
Create Projectile Interface
abhi6403 Aug 6, 2024
a8e629f
create Bullet MVC
abhi6403 Aug 6, 2024
3116a66
Create model and view
abhi6403 Aug 6, 2024
502aaf3
Create Bullets
abhi6403 Aug 6, 2024
130b20b
Spawn bullets
abhi6403 Aug 6, 2024
81d2744
Move the Bullets
abhi6403 Aug 6, 2024
0f2b87d
Firing the bullets
abhi6403 Aug 6, 2024
0ff7726
Create Collectible
abhi6403 Aug 7, 2024
5816685
create Powerup Controllers
abhi6403 Aug 7, 2024
baf2bc3
spawn powerups and new enemy.
abhi6403 Aug 10, 2024
07eaece
Create UI interface
abhi6403 Aug 12, 2024
6474f48
Change the UI service
abhi6403 Aug 12, 2024
eb263ab
using Image view
abhi6403 Aug 12, 2024
7313ed2
create Text View
abhi6403 Aug 13, 2024
2001d8e
creating button view
abhi6403 Aug 13, 2024
b15f0d5
changed the color of background
abhi6403 Aug 13, 2024
a2a6c5d
Create Multiple Entities
abhi6403 Aug 14, 2024
33d9633
Collision Interface and Service
abhi6403 Aug 14, 2024
dc2ddba
Create Player Collision
abhi6403 Aug 14, 2024
c100888
Implement Player Collision
abhi6403 Aug 14, 2024
0abc3cf
create Bullet Collision
abhi6403 Aug 14, 2024
609aac5
create Enemy and Powerup collisions
abhi6403 Aug 15, 2024
446b73b
corrections
abhi6403 Aug 15, 2024
37e1b8f
adding UI elements on screen
abhi6403 Aug 15, 2024
249d16a
cleared errors
abhi6403 Aug 16, 2024
d43466e
minor changes
abhi6403 Aug 16, 2024
936f022
commented destroy bullet
abhi6403 Aug 16, 2024
df05632
create new UI Screen
abhi6403 Aug 16, 2024
051fd54
Implemented Animated Image View
abhi6403 Aug 17, 2024
986d131
Animated UI Screen
abhi6403 Aug 17, 2024
4251311
Data for Animations
abhi6403 Aug 17, 2024
5507ff6
Creating Animation System
abhi6403 Aug 17, 2024
b4f5e74
Creating Animation Service
abhi6403 Aug 17, 2024
b2b4e7e
Creating explosions
abhi6403 Aug 17, 2024
bc26548
Refining Player
abhi6403 Aug 17, 2024
214c4d0
Refining powerup
abhi6403 Aug 17, 2024
371769b
Refining Enemy
abhi6403 Aug 18, 2024
2aff592
Refining bullet
abhi6403 Aug 18, 2024
1673da5
Refining Bunker
abhi6403 Aug 18, 2024
48bb62c
Refining gameplay
abhi6403 Aug 19, 2024
0fb03eb
Refining UI
abhi6403 Aug 19, 2024
33ee2ce
freeze update
abhi6403 Aug 19, 2024
bd5ab9d
bullet update
abhi6403 Aug 19, 2024
e644a47
refined
abhi6403 Aug 20, 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
36 changes: 36 additions & 0 deletions Space-Invaders/Header/AnimationSystem/AnimationService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once
#include <vector>
#include <SFML/System/Vector2.hpp>
#include "../../header/AnimationSystem/AnimationSystem.h"

namespace Animation
{
enum class AnimationType
{
EXPLOSION,
};

class AnimationService
{
private:
std::vector<AnimationSystem*> animation_system_list;
std::vector<AnimationSystem*> flagged_animation_system_list;

AnimationSystemConfig getAnimationSystemConfig(AnimationType animation_type);
void destroyFlaggedAnimationSystem();
void destroy();

public:
AnimationService();
virtual ~AnimationService();

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

void reset();

void spawnAnimationSystem(sf::Vector2f position, AnimationType animation_type);
void destroyAnimationSystem(AnimationSystem* animation_system);
};
}
33 changes: 33 additions & 0 deletions Space-Invaders/Header/AnimationSystem/AnimationSystem.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "../../header/AnimationSystem/AnimationSystemConfig.h"
#include "../../header/UI/UIElement/ImageView.h"

namespace Animation
{
class AnimationSystem
{
private:
AnimationSystemConfig animation_system_config;

sf::Vector2f animation_position;
UI::UIElement::ImageView* animation_image;

void createUIElements();
void initializeImage();

int current_frame;
sf::Clock clock;
sf::Time frame_time;

public:
AnimationSystem(AnimationSystemConfig config);
~AnimationSystem();

void initialize(sf::Vector2f position);
void update();
void render();

void destroy();
};
}
30 changes: 30 additions & 0 deletions Space-Invaders/Header/AnimationSystem/AnimationSystemConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

namespace Animation
{
struct AnimationSystemConfig
{
sf::String Animation_texture_path;

float sprite_sheet_width;
float sprite_sheet_height;

float tile_width; //one frame of the sprite sheet
float tile_height;

int number_of_animation_frames; //total frames
float frame_duration; //duration of a single frame

AnimationSystemConfig() = default; // Use default for default constructor

//this will allow us to initialize an animation with it's configuration.
AnimationSystemConfig(sf::String texture_path, float sprite_width, float sprite_height, float t_width, float t_height, int frames, float duration) :
Animation_texture_path(texture_path),
sprite_sheet_width(sprite_width),
sprite_sheet_height(sprite_height),
tile_width(t_width),
tile_height(t_height),
number_of_animation_frames(frames),
frame_duration(duration) {}
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#pragma once
#include "AnimationSystemConfig.h"
#include "../../header/Global/Config.h"

namespace Animation
{
const AnimationSystemConfig explosion_animation_config(Global::Config::explosion_texture_path, 70.0f, 80.0f, 14.28f, 20.0f, 7, 0.03f);
}
28 changes: 28 additions & 0 deletions Space-Invaders/Header/Bullet/BulletConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#include<SFML/Graphics.hpp>

namespace Bullet
{
enum class BulletType
{
LASER_BULLET,
TORPEDO,
FROST_BULLET,
};

enum class MovementDirection
{
UP,
DOWN,
};

class BulletConfig
{
public:
static const sf::String laser_bullet_texture_path;
static const sf::String torpedoe_texture_path;
static const sf::String frost_beam_texture_path;

static sf::String getBulletTexturePath(BulletType bullet_type);
};
}
47 changes: 47 additions & 0 deletions Space-Invaders/Header/Bullet/BulletController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#pragma once
#include"../../Header/Projectile/IProjectile.h"
#include"../../Header/Bullet/BulletConfig.h"
#include"../../Header/Entity/EntityConfig.h"
#include"../../Header/Collision/ICollider.h"

namespace Bullet
{
class BulletView;
class BulletModel;

enum class BulletType;

class BulletController :public Projectile::IProjectile,public Collision::ICollider
{
protected:
BulletView* bullet_view;
BulletModel* bullet_model;

void updateProjectilePosition() override;

void processBulletCollision(ICollider* other_collider);
void processEnemyCollision(ICollider* other_collider);
void processPlayerCollision(ICollider* other_collider);
void processBunkerCollision(ICollider* other_collider);

void moveUP();
void moveDown();
void handleOutOfBounds();

public:
BulletController(BulletType bullet_type,Entity::EntityType owner_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();

Entity::EntityType getOwnerEntityType();

const sf::Sprite& getColliderSprite() override;
void onCollision(ICollider* other_collider) override;
};
}
38 changes: 38 additions & 0 deletions Space-Invaders/Header/Bullet/BulletModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#pragma once
#include<SFML/Graphics.hpp>
#include"../../Header/Entity/EntityConfig.h"

namespace Bullet
{
enum class BulletType;
enum class MovementDirection;

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

BulletType bullet_type;
Entity::EntityType owner_type;
MovementDirection movement_direction;

public:
BulletModel(BulletType bullet_type, Entity::EntityType owner_type);
~BulletModel();

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

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

BulletType getBulletType();
Entity::EntityType getOwnerEntityType();

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

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

namespace Bullet
{

enum class BulletType;
enum class MovementDirection;
class BulletController;

class BulletService
{
private:

std::vector<Projectile::IProjectile*>projectile_list;
std::vector<Projectile::IProjectile*>flagged_bullet_list;

BulletController* createBullet(BulletType bullet_type,Entity::EntityType owner_type);

bool isValidBullet(int index_i, std::vector<Projectile::IProjectile*>& bullet_list);
void destroyFlaggedBullets();

void destroy();

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

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

void reset();

BulletController* spawnBullet(BulletType bullet_type,Entity::EntityType owner_type, sf::Vector2f position, MovementDirection direction);
void destroyBullet(BulletController* bullet_controller);
};

}
34 changes: 34 additions & 0 deletions Space-Invaders/Header/Bullet/BulletView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#pragma once
#include<SFML/Graphics.hpp>
#include "../../Header/UI/UIElement/ImageView.h"

namespace Bullet
{
class BulletController;

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

BulletController* bullet_controller;
UI::UIElement::ImageView* bullet_image;

void initializeImage();
void createUIElements();
sf::String getBulletTexturePath();

void destroy();

public:
BulletView();
~BulletView();

void initialize(BulletController* controller);
void update();
void render();

const sf::Sprite& getBulletSprite();
};
}
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 frost_bullet_movement_speed = 500.f;

public:
FrostBulletController(BulletType bullet_type, Entity::EntityType owner_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 bullet_type, Entity::EntityType owner_type);
~LaserBulletController();

void initialize(sf::Vector2f position, MovementDirection)override;
};
}
}
20 changes: 20 additions & 0 deletions Space-Invaders/Header/Bullet/Controllers/TorpedoeController.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 bullet_type,Entity::EntityType owner_type);
~TorpedoController();

void initialize(sf::Vector2f position, MovementDirection direction)override;
};
}
}
19 changes: 19 additions & 0 deletions Space-Invaders/Header/Collectible/ICollectible.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#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() {};
};


}
Loading