Skip to content

Commit

Permalink
[JOS-71] Boss class has been added and was given aload of provisions …
Browse files Browse the repository at this point in the history
…for things like animations and AI to be slotted in soon, I also crafted the sprite sheet for the boss with a handful of fades and states.
  • Loading branch information
JoshMooney committed Apr 13, 2016
1 parent 481f37b commit 30fa57f
Show file tree
Hide file tree
Showing 21 changed files with 449 additions and 76 deletions.
4 changes: 2 additions & 2 deletions FYP_FallenHero.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 14
VisualStudioVersion = 14.0.23107.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FYP_FallenHero", "FYP_FallenHero\FYP_FallenHero.vcxproj", "{52EFCF1A-1045-478F-A8DF-88EF9EA926D3}"
EndProject
Expand Down
Binary file added FYP_FallenHero/Assets/Game/boss.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FYP_FallenHero/Assets/Game/boss_temp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FYP_FallenHero/Assets/Game/door_prompt.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added FYP_FallenHero/Assets/Game/letter_e.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -468,4 +468,5 @@
</object>
</objectgroup>
<objectgroup name="Level_Data"/>
<objectgroup name="Platform"/>
</map>
13 changes: 11 additions & 2 deletions FYP_FallenHero/Assets/Levels/LVL_1.tmx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="90" height="25" tilewidth="32" tileheight="32" nextobjectid="39">
<map version="1.0" orientation="orthogonal" renderorder="right-down" width="90" height="25" tilewidth="32" tileheight="32" nextobjectid="40">
<tileset firstgid="1" name="tile_set" tilewidth="32" tileheight="32" tilecount="3">
<image source="Tiles/tile_set.png" width="96" height="32"/>
</tileset>
Expand Down Expand Up @@ -49,7 +49,16 @@
</objectgroup>
<objectgroup name="BG"/>
<objectgroup name="FG"/>
<objectgroup name="Enemy_Data"/>
<objectgroup name="Enemy_Data">
<object id="39" name="Dark Demon" x="576" y="480" width="32" height="64">
<properties>
<property name="direction" value="0"/>
<property name="type" value="Boss"/>
<property name="x" value="576"/>
<property name="y" value="480"/>
</properties>
</object>
</objectgroup>
<objectgroup name="Blocks"/>
<objectgroup name="Level_Data">
<object id="35" name="UnlockSensor" x="256" y="352" width="224" height="192">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,5 @@
</object>
</objectgroup>
<objectgroup name="Level_Data"/>
<objectgroup name="Platform"/>
</map>
48 changes: 24 additions & 24 deletions FYP_FallenHero/Assets/save_data.xml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<Root>
<SaveGame>
<SaveSlot1>
<TimePlayed>12</TimePlayed>
<TimePlayed>167</TimePlayed>
<CurrentGold>0</CurrentGold>
<Levels>
<LVL1>0</LVL1>
<LVL2>0</LVL2>
<LVL3>1</LVL3>
<LVL3>0</LVL3>
<LVL4>1</LVL4>
<LVL5>1</LVL5>
<LVL6>1</LVL6>
<LVL7>1</LVL7>
</Levels>
<Achievements>
<ACH1>0</ACH1>
<ACH2>0</ACH2>
<ACH1>1</ACH1>
<ACH2>1</ACH2>
<ACH3>0</ACH3>
<ACH4>0</ACH4>
<ACH4>1</ACH4>
<ACH5>0</ACH5>
<ACH6>0</ACH6>
<ACH7>0</ACH7>
<ACH8>0</ACH8>
<ACH9>0</ACH9>
<ACH9>1</ACH9>
<ACH10>1</ACH10>
<ACH11>0</ACH11>
<ACH11>1</ACH11>
<ACH12>0</ACH12>
<ACH13>0</ACH13>
<ACH14>0</ACH14>
Expand All @@ -49,38 +49,38 @@
</Statistics>
</SaveSlot1>
<SaveSlot2>
<TimePlayed>0</TimePlayed>
<CurrentGold>0</CurrentGold>
<TimePlayed>85</TimePlayed>
<CurrentGold>940</CurrentGold>
<Levels>
<LVL1>0</LVL1>
<LVL2>1</LVL2>
<LVL3>1</LVL3>
<LVL2>0</LVL2>
<LVL3>0</LVL3>
<LVL4>1</LVL4>
<LVL5>1</LVL5>
<LVL6>1</LVL6>
<LVL5>0</LVL5>
<LVL6>0</LVL6>
<LVL7>1</LVL7>
</Levels>
<Achievements>
<ACH1>0</ACH1>
<ACH2>0</ACH2>
<ACH3>0</ACH3>
<ACH4>0</ACH4>
<ACH1>1</ACH1>
<ACH2>1</ACH2>
<ACH3>1</ACH3>
<ACH4>1</ACH4>
<ACH5>0</ACH5>
<ACH6>0</ACH6>
<ACH7>0</ACH7>
<ACH8>0</ACH8>
<ACH9>0</ACH9>
<ACH10>0</ACH10>
<ACH11>0</ACH11>
<ACH12>0</ACH12>
<ACH9>1</ACH9>
<ACH10>1</ACH10>
<ACH11>1</ACH11>
<ACH12>1</ACH12>
<ACH13>0</ACH13>
<ACH14>0</ACH14>
<ACH14>1</ACH14>
<ACH15>0</ACH15>
<ACH16>0</ACH16>
<ACH17>0</ACH17>
<ACH18>0</ACH18>
<ACH19>0</ACH19>
<ACH20>0</ACH20>
<ACH19>1</ACH19>
<ACH20>1</ACH20>
<ACH21>0</ACH21>
</Achievements>
<Statistics>
Expand Down
123 changes: 123 additions & 0 deletions FYP_FallenHero/DarkDemon.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
#include "stdafx.h"
#include "DarkDemon.hpp"

DarkDemon::DarkDemon() {

}
DarkDemon::DarkDemon(b2Body * b, ProjectileManager* pm, bool dir) : m_projectile_mgr(pm) {
b->SetUserData(this);
e_box_body = b;

m_current_state = IDLE;
m_previous_state = m_current_state;

loadMedia();
alineSprite();

e_body_active = true;
e_sword_col = false;
e_can_despawn = false;
setDirection(dir);
e_direction = dir;

m_speed = 0.35f;
speedFactor = 0;
e_hp = 100;
}
DarkDemon::~DarkDemon() {

}

void DarkDemon::ChangeState(STATE s) {

}
void DarkDemon::loadMedia() {
e_texture = "Assets/Game/boss_temp.png";
setTexture(ResourceManager<sf::Texture>::instance()->get(e_texture));
m_text_size = sf::Vector2u(35, 44);
setOrigin(m_text_size.x / 2, m_text_size.y / 2);
/*
addFrames(frame_death, 0, 0, 7, 38, 47, 1.0f);
addFrames(frame_idle, 1, 0, 4, m_text_size.x, m_text_size.y, 1.0f);
addFrames(frame_walk, 2, 0, 4, m_text_size.x, m_text_size.y, 1.0f);
addFrames(frame_attack, 3, 0, 4, 29, m_text_size.y, 1.0f);
m_animator.addAnimation(DEATH, frame_death, sf::seconds(0.5f));
m_animator.addAnimation(IDLE, frame_idle, sf::seconds(0.5f));
m_animator.addAnimation(WALKING, frame_walk, sf::seconds(0.5f));
m_animator.addAnimation(ATTACKING, frame_attack, sf::seconds(0.15f));*/

/*
s_death = "Assets/Audio/Game/skeleton_kill.wav";
m_death.setBuffer(ResourceManager<sf::SoundBuffer>::instance()->get(s_death));*/
}
void DarkDemon::checkAnimation() {
/*if (m_previous_state != m_current_state) {
m_previous_state = m_current_state;
m_animator.playAnimation(m_current_state);
}
if (m_current_state == IDLE && !m_animator.isPlayingAnimation())
m_animator.playAnimation(IDLE);*/
}
void DarkDemon::addFrames(thor::FrameAnimation& animation, int y, int xFirst, int xLast, int xSep, int ySep, float duration) {
if (y == 0)
y = 0;
else if (y == 1)
y = 47;
else if (y == 2)
y = 91;
else if (y == 3)
y = 135;

for (int x = xFirst; x != xLast; x += 1)
animation.addFrame(duration, sf::IntRect(xSep * x, y, xSep, ySep));
}

void DarkDemon::update(FTS fts, Player * p) {
checkAnimation();
alineSprite();

}
void DarkDemon::render(sf::RenderWindow & w, sf::Time frames) {
/*m_animator.update(frames);
m_animator.animate(*this);*/
}

void DarkDemon::TakeDamage() {
if (!is_hit) {
is_hit = true;
e_hp -= 10;
if (e_hp <= 0)
Die();
}
}
void DarkDemon::Die() {
e_box_body->GetFixtureList()->SetSensor(true);
e_body_active = false;
}
void DarkDemon::move() {

}
void DarkDemon::attack() {

}
void DarkDemon::alineSprite() {
setPosition(vHelper::toSF(e_box_body->GetPosition()));
}
void DarkDemon::ChangeDirection() {
e_direction = !e_direction;
if (e_direction) setScale(1, 1);
else setScale(-1, 1);
}
void DarkDemon::setDirection(bool dir) {
e_direction = dir;
if (e_direction) setScale(1, 1);
else setScale(-1, 1);
}
void DarkDemon::ReachedWall() {

}
void DarkDemon::ReachPlayer() {

}
Loading

0 comments on commit 30fa57f

Please sign in to comment.