This commit is contained in:
2024-01-30 16:22:53 +01:00
9 changed files with 189 additions and 160 deletions
+36 -36
View File
@@ -1,37 +1,37 @@
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Visual Studio
.vs
vcpkg_installed
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
# Visual Studio
.vs
vcpkg_installed
x64
+30 -1
View File
@@ -1 +1,30 @@
# Space-Invader
# Space Invader
## Concept et genre
Space Invader est un jeu d'arcade de type shoot'em up.
## Scénario de base
Des aliens envahissent la Terre et le joueur doit les détruire avant qu'ils n'atteignent son vaisseau sur
Terre.
## Mécaniques de base
Le vaisseau peut se déplacer horizontalement et tirer des projectiles vers le haut. Les aliens
descendent progressivement vers le vaisseau et tirent des projectiles vers le bas.
## Style visuel
Le jeu est en 2D avec une vue de profil. Le vaisseau et les aliens sont représentés par des formes
simple (rectangulaire et triangluraire) et couleurs différentes pour les différencier.
## Objectifs
Le joueur doit détruire tous les aliens avant qu'ils n'atteignent le vaisseau. Tout en évitant les
projectiles aliens.
## Contrôles
Le joueur peut se déplacer horizontalement avec les touches Q (Gauche) et D (Droite). Il peut tirer
avec la barre d'espace.
+31 -31
View File
@@ -1,31 +1,31 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Space-Invader", "Space-Invader.vcxproj", "{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.ActiveCfg = Debug|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.Build.0 = Debug|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.ActiveCfg = Debug|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.Build.0 = Debug|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.ActiveCfg = Release|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.Build.0 = Release|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.ActiveCfg = Release|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC394877-8CB5-406D-846E-C6337AFC7323}
EndGlobalSection
EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.8.34330.188
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Space-Invader", "Space-Invader.vcxproj", "{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.ActiveCfg = Debug|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x64.Build.0 = Debug|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.ActiveCfg = Debug|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Debug|x86.Build.0 = Debug|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.ActiveCfg = Release|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x64.Build.0 = Release|x64
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.ActiveCfg = Release|Win32
{77E81A7A-9E66-4C14-8C8C-2D046FEB7DE8}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {FC394877-8CB5-406D-846E-C6337AFC7323}
EndGlobalSection
EndGlobal
+25 -25
View File
@@ -1,25 +1,25 @@
#pragma once
#define _USE_MATH_DEFINES
#include <SFML/Graphics.hpp>
#include <iostream>
#include <cmath>
using namespace std;
using namespace sf;
class Player
{
public:
Player(Vector2u screenSize);
CircleShape& getShape() { return _shape; };
void move(int direction);
private:
CircleShape _shape;
int _screenWidth;
};
#pragma once
#define _USE_MATH_DEFINES
#include <SFML/Graphics.hpp>
#include <iostream>
#include <cmath>
using namespace std;
using namespace sf;
class Player
{
public:
Player(Vector2u screenSize);
CircleShape& getShape() { return _shape; };
void move(int direction);
private:
CircleShape _shape;
int _screenWidth;
};
+10 -10
View File
@@ -1,11 +1,11 @@
#include "Laser.h"
Laser::Laser(Window& _window)
{
_laser = RectangleShape(Vector2f(_window.getSize().x / 600, _window.getSize().y / 30));
_laser.setFillColor(Color::White);
}
void Laser::setInitialPosition(Vector2f position) {
_laser.setPosition(Vector2f(position.x - (_laser.getScale().x / 2), position.y));
#include "Laser.h"
Laser::Laser(Window& _window)
{
_laser = RectangleShape(Vector2f(_window.getSize().x / 600, _window.getSize().y / 30));
_laser.setFillColor(Color::White);
}
void Laser::setInitialPosition(Vector2f position) {
_laser.setPosition(Vector2f(position.x - (_laser.getScale().x / 2), position.y));
}
+21 -21
View File
@@ -1,22 +1,22 @@
#include "Player.h";
Player::Player(Vector2u screenSize): _screenWidth(screenSize.x) {
_shape = CircleShape(screenSize.x / 70, 3);
_shape.setFillColor(Color(52, 252, 5));
float shapeHeight = _shape.getRadius() * 1.5;
_shape.setPosition(_screenWidth / 2.f, screenSize.y - shapeHeight);
}
void Player::move(int direction) {
float max = _screenWidth - (_shape.getRadius() * 2);
float result = (_screenWidth / 724.0)*direction;
// Prevent leaving the window
if (_shape.getPosition().x + result < 0 || _shape.getPosition().x + result > max) {
result = 0;
}
_shape.move(result, 0);
#include "Player.h";
Player::Player(Vector2u screenSize): _screenWidth(screenSize.x) {
_shape = CircleShape(screenSize.x / 70, 3);
_shape.setFillColor(Color(52, 252, 5));
float shapeHeight = _shape.getRadius() * 1.5;
_shape.setPosition(_screenWidth / 2.f, screenSize.y - shapeHeight);
}
void Player::move(int direction) {
float max = _screenWidth - (_shape.getRadius() * 2);
float result = (_screenWidth / 724.0)*direction;
// Prevent leaving the window
if (_shape.getPosition().x + result < 0 || _shape.getPosition().x + result > max) {
result = 0;
}
_shape.move(result, 0);
}
+12 -12
View File
@@ -1,13 +1,13 @@
#include "Shield.h"
Shield::Shield(Window& window) {
int shapeWidth = window.getSize().x / 10;
int shapeHeight = window.getSize().y / 35;
_shape = RectangleShape(Vector2f(shapeWidth, shapeHeight));
_shape.setFillColor(Color(Color(52, 252, 5)));
}
void Shield::setPosition(Vector2f position) {
_shape.setPosition(position.x + _shape.getSize().x, position.y - _shape.getScale().y);
#include "Shield.h"
Shield::Shield(Window& window) {
int shapeWidth = window.getSize().x / 10;
int shapeHeight = window.getSize().y / 35;
_shape = RectangleShape(Vector2f(shapeWidth, shapeHeight));
_shape.setFillColor(Color(Color(52, 252, 5)));
}
void Shield::setPosition(Vector2f position) {
_shape.setPosition(position.x + _shape.getSize().x, position.y - _shape.getScale().y);
}
+15 -15
View File
@@ -1,16 +1,16 @@
using namespace std;
#include <iostream>
#include "GameManager.h"
int main()
{
cout << "Starting game..." << endl;
GameManager gameManager;
cout << "Game started." << endl;
gameManager.run();
return 0;
using namespace std;
#include <iostream>
#include "GameManager.h"
int main()
{
cout << "Starting game..." << endl;
GameManager gameManager;
cout << "Game started." << endl;
gameManager.run();
return 0;
}
+9 -9
View File
@@ -1,10 +1,10 @@
{
"name": "space-invader",
"version": "0.0.0",
"description": "Space Invader Copy",
"dependencies": [
{
"name": "sfml"
}
]
{
"name": "space-invader",
"version": "0.0.0",
"description": "Space Invader Copy",
"dependencies": [
{
"name": "sfml"
}
]
}