-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a862fd6
commit 96f6b53
Showing
34 changed files
with
3,252 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
target_sources (SuperMario PRIVATE "main.cpp" | ||
"GameWindow.cpp" | ||
"Controller.cpp" | ||
"Board.cpp" | ||
"GameObject.cpp" | ||
"MovingObject.cpp" | ||
"Platforms.cpp" | ||
"SuperMushroom.cpp" | ||
"Player.cpp" | ||
"Enemy.cpp" | ||
"BadMushroom.cpp" | ||
"PiranaPlants.cpp" | ||
"FlyingTortoise.cpp" | ||
"Tortoise.cpp" | ||
"Obstacle.cpp" | ||
"FireBall.cpp" | ||
"FirePole.cpp" | ||
"StaticObject.cpp" | ||
"Pickable.cpp" | ||
"Coin.cpp" | ||
"UnPickable.cpp" | ||
"Floor.cpp" | ||
"Brick.cpp" | ||
"QuestionBlock.cpp" | ||
"Pipe.cpp" | ||
"Block.cpp" | ||
"GoalFlag.cpp" | ||
"AudioHolder.cpp" | ||
"TextureHolder.cpp" | ||
"Animation.cpp" | ||
"Collision.cpp" | ||
"GoalPole.cpp" | ||
"Fireworks.cpp") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "BadMushroom.h" | ||
|
||
BadMushroom::BadMushroom(int row, int col) | ||
: Enemy(TextureHolder::instance().getEnemy(I_BADMUSHROOM), LEFT, BAD_MUSH_SIZE, row ,col) | ||
{ | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void BadMushroom::move(sf::Time deltaTime) | ||
{ | ||
if (!m_dead) | ||
{ | ||
sideMove(deltaTime, ENEMY_SPEED); | ||
m_animation.staticShift(deltaTime, SWITCH); | ||
m_animation.setDirection(m_dir); | ||
} | ||
else if (m_tortoiseKill) | ||
handleDeathTortoise(deltaTime); | ||
|
||
else | ||
handleDeath(deltaTime); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
BadMushroom::~BadMushroom() | ||
{ | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#include "Enemy.h" | ||
|
||
Enemy::Enemy(const sf::Texture& data, bool dir, int size, int row, int col) | ||
: MovingObject(data, dir, size,row,col) | ||
{ | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
Enemy::~Enemy() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#include "FlyingTortoise.h" | ||
|
||
FlyingTortoise::FlyingTortoise(int row, int col) | ||
: Enemy(TextureHolder::instance().getEnemy(I_F_TORTOISE), RIGHT, F_TORTOISE_SIZE,row,col) | ||
{ | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void FlyingTortoise::move(sf::Time deltaTime) | ||
{ | ||
if (!m_dead) | ||
upDownMove(deltaTime, ENEMY_SPEED, MAX_HEIGHT, MIN_HEIGHT, SWITCH); | ||
else | ||
handleDeath(deltaTime); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void FlyingTortoise::handleDeath(sf::Time deltaTime) | ||
{ | ||
if (m_deathTimePassed == 0) | ||
m_velocity.y = 0; | ||
|
||
fall(deltaTime); | ||
m_sprite.move(m_velocity); | ||
m_deathTimePassed += deltaTime.asSeconds(); | ||
|
||
// His death is ended | ||
if (m_deathTimePassed > DEATH_TIME) | ||
isDelete(); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
FlyingTortoise::~FlyingTortoise() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "PiranaPlants.h" | ||
|
||
PiranaPlants::PiranaPlants(int row, int col) | ||
: Enemy(TextureHolder::instance().getEnemy(I_PIRANA), LEFT, PIRANA_SIZE,row,col) | ||
{ | ||
m_sprite.setScale(PIRANA_SCALE, PIRANA_SCALE); | ||
m_sprite.setPosition((float)(col * ICON_SIZE+ PIPE_X_POS), | ||
(float)((row * ICON_SIZE + PIPE_Y_POS))); | ||
m_lastPos = m_sprite.getPosition(); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void PiranaPlants::move(sf::Time deltaTime) | ||
{ | ||
if (m_dead) | ||
m_delete = true; | ||
upDownMove(deltaTime, PIRANA_SPEED, m_lastPos.y, m_lastPos.y + ICON_SIZE * PIRANA_MOV, SWITCH_PIRANA); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
PiranaPlants::~PiranaPlants() | ||
{ | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "Tortoise.h" | ||
|
||
Tortoise::Tortoise(int row, int col) | ||
: Enemy(TextureHolder::instance().getEnemy(I_TORTOISE), LEFT, TORTOISE_SIZE, row ,col), | ||
m_shell(false), m_jumped(false) | ||
{ | ||
m_sprite.setPosition((float)(col * ICON_SIZE), | ||
(float)((row * ICON_SIZE)) + TORTOISE_Y_POS); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void Tortoise::move(sf::Time deltaTime) | ||
{ | ||
if (!m_shell) | ||
{ | ||
sideMove(deltaTime, ENEMY_SPEED); | ||
m_animation.staticShift(deltaTime, SWITCH); | ||
m_animation.setDirection(m_dir); | ||
} | ||
|
||
else if (m_jumped) | ||
sideMove(deltaTime, SHELL_SPEED); | ||
|
||
if (m_tortoiseKill) | ||
handleDeathTortoise(deltaTime); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void Tortoise::setShell() | ||
{ | ||
m_shell = true; | ||
m_animation.setDeadSprite(); | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
bool Tortoise::getShell() const | ||
{ | ||
return m_shell; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void Tortoise::setJumped(bool condition) | ||
{ | ||
m_jumped = condition; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
bool Tortoise::getJumped() const | ||
{ | ||
return m_jumped; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
void Tortoise::setDirection(float playerPosX) | ||
{ | ||
if (playerPosX > getPos().x) | ||
m_dir = LEFT; | ||
else | ||
m_dir = RIGHT; | ||
} | ||
|
||
//----------------------------------------------------------------------------- | ||
Tortoise::~Tortoise() | ||
{ | ||
} |
Oops, something went wrong.