Skip to content

Commit d98f491

Browse files
authored
Merge pull request #44 from DianaVasiliu/diana
Add gameplay / demo
2 parents c6aaf78 + 4337f01 commit d98f491

File tree

7 files changed

+34
-16
lines changed

7 files changed

+34
-16
lines changed

OpenRocket/OpenRocket/Asteroid.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,11 @@ float Asteroid::getRadius() const {
8787
float Asteroid::getY() const {
8888
return this->coordinates.y;
8989
}
90+
91+
void Asteroid::setToBeDeleted(bool t) {
92+
toBeDeleted = t;
93+
}
94+
95+
bool Asteroid::getToBeDeleted() const {
96+
return toBeDeleted;
97+
}

OpenRocket/OpenRocket/Asteroid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Asteroid {
3636
bool inLowerHalf();
3737
bool belowViewport();
3838

39-
bool getToBeDeleted() const { return toBeDeleted; }
39+
bool getToBeDeleted() const;
4040
float getX() const;
4141
float getY() const;
4242
float getRadius() const;
@@ -49,7 +49,7 @@ class Asteroid {
4949
void setX(float);
5050
void setY(float);
5151
void setTranslatedDistance(float);
52-
void setToBeDeleted(bool t) { toBeDeleted = t; }
52+
void setToBeDeleted(bool);
5353
void setAsteroidMatrix(glm::mat4);
5454
void setCurrentZone(string);
5555
};

OpenRocket/OpenRocket/Bullet.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ void Bullet::setY(float y) {
4343
void Bullet::setTranslatedDistance(float distance) {
4444
translatedDistance = distance;
4545
}
46+
47+
bool Bullet::getToBeDeleted() const {
48+
return toBeDeleted;
49+
}
50+
51+
void Bullet::setToBeDeleted(bool t) {
52+
toBeDeleted = t;
53+
}

OpenRocket/OpenRocket/Bullet.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ class Bullet {
1919
float getX() const;
2020
float getY() const;
2121
float getTranslatedDistance() const;
22-
bool getToBeDeleted() { return toBeDeleted; }
23-
24-
static glm::vec4 bulletCenter;
25-
static glm::vec4 bulletPoint;
26-
glm::mat4 bulletMatrix;
22+
bool getToBeDeleted() const;
2723

2824
void setX(float);
2925
void setY(float);
3026
void setTranslatedDistance(float);
31-
void setToBeDeleted(bool t) { toBeDeleted = t; }
27+
void setToBeDeleted(bool);
3228

29+
static glm::vec4 bulletCenter;
30+
static glm::vec4 bulletPoint;
31+
glm::mat4 bulletMatrix;
3332
bool aboveViewport();
3433
};

OpenRocket/OpenRocket/Game.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -727,10 +727,10 @@ void Game::CreateHeartBuffers() {
727727

728728
void Game::CreateGameOverBuffers() {
729729
GLfloat Vertices[] = {
730-
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
731-
Constants::maxX, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
732-
Constants::maxX, Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f,
733-
0.0f, Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
730+
0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
731+
(GLfloat)Constants::maxX, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f,
732+
(GLfloat)Constants::maxX,(GLfloat)Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f,
733+
0.0f,(GLfloat)Constants::maxY, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f,
734734
};
735735

736736
glGenVertexArrays(1, &gameOverVao);

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
## Basic idea
44

5-
- the player will control a rocket using the keyboard
6-
- there will be asteroids, that must be avoided by the player
7-
- the asteroids will move along one axis
8-
- (extra) the rocket will have an attack and can destroy the asteroids
5+
A rocket on a mission in space must escape a wave of dangerous asteroids. To finish the mission and get home safe, the rocket can either avoid asteroids or destroy them with its weapon. If the rocket collides with an asteroid, it loses one life, but if it remains without lives, it explodes and the game ends.
6+
7+
## Gameplay
8+
9+
<p align="center">
10+
<img src="demo.gif" alt="Demo" width="80%"/>
11+
</p>
912

1013
## Libraries
1114

demo.gif

6.8 MB
Loading

0 commit comments

Comments
 (0)