Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
matangeorgi authored Jul 25, 2021
1 parent a862fd6 commit 96f6b53
Show file tree
Hide file tree
Showing 34 changed files with 3,252 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/CMakeLists.txt
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")

28 changes: 28 additions & 0 deletions src/Enemys/BadMushroom.cpp
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()
{
}

11 changes: 11 additions & 0 deletions src/Enemys/Enemy.cpp
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()
{
}
35 changes: 35 additions & 0 deletions src/Enemys/FlyingTortoise.cpp
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()
{
}
23 changes: 23 additions & 0 deletions src/Enemys/PiranaPlants.cpp
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()
{
}
65 changes: 65 additions & 0 deletions src/Enemys/Tortoise.cpp
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()
{
}
Loading

0 comments on commit 96f6b53

Please sign in to comment.