Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/media/corpses.png b/media/corpses.png
index 2ccb4c0..71ad7c9 100644
Binary files a/media/corpses.png and b/media/corpses.png differ
diff --git a/media/slime.png b/media/slime.png
index 4a623aa..6dbda46 100644
Binary files a/media/slime.png and b/media/slime.png differ
diff --git a/media/sound/slime_impact.ogg b/media/sound/slime_impact.ogg
new file mode 100644
index 0000000..cad0d59
Binary files /dev/null and b/media/sound/slime_impact.ogg differ
diff --git a/media/sound/slime_impact_weak.ogg b/media/sound/slime_impact_weak.ogg
new file mode 100644
index 0000000..61b21a2
Binary files /dev/null and b/media/sound/slime_impact_weak.ogg differ
diff --git a/media/sound/slime_jump.ogg b/media/sound/slime_jump.ogg
new file mode 100644
index 0000000..833a146
Binary files /dev/null and b/media/sound/slime_jump.ogg differ
diff --git a/src/BaseCreatureEntity.cpp b/src/BaseCreatureEntity.cpp
index 28c3cd3..8c66d04 100644
--- a/src/BaseCreatureEntity.cpp
+++ b/src/BaseCreatureEntity.cpp
@@ -1,107 +1,103 @@
#include "BaseCreatureEntity.h"
#include "sfml_game/ImageManager.h"
#include "Constants.h"
#include "WitchBlastGame.h"
-// uncomment to show bounding box in the app
-// #define SHOW_BOUNDING_BOX
-
BaseCreatureEntity::BaseCreatureEntity(sf::Texture* image, float x = 0.0f, float y = 0.0f, int spriteWidth = -1, int spriteHeight = -1)
: CollidingSpriteEntity (image, x, y, spriteWidth, spriteHeight)
{
hurting = false;
shadowFrame = -1;
}
void BaseCreatureEntity::setParent(WitchBlastGame* parent)
{
parentGame = parent;
}
int BaseCreatureEntity::getHp()
{
return hp;
}
int BaseCreatureEntity::getHpMax()
{
return hpMax;
}
int BaseCreatureEntity::getHpDisplay()
{
return hpDisplay;
}
void BaseCreatureEntity::animate(float delay)
{
if (hpDisplay > hp) hpDisplay--;
else if (hpDisplay < hp) hpDisplay++;
z = y + height/2;
if (hurting)
{
hurtingDelay -= delay;
if (hurtingDelay > 0.0f)
{
int fadeColor = (sf::Uint8)((HURTING_DELAY - hurtingDelay) * 255);
sprite.setColor(sf::Color(255, fadeColor, fadeColor, 255 ));
}
else
{
hurting = false;
sprite.setColor(sf::Color(255, 255, 255, 255 ));
}
}
CollidingSpriteEntity::animate(delay);
}
void BaseCreatureEntity::render(sf::RenderWindow* app)
{
if (!isDying && shadowFrame > -1)
{
// shadow
sprite.setTextureRect(sf::IntRect(shadowFrame * width, 0, width, height));
app->draw(sprite);
}
CollidingSpriteEntity::render(app);
#ifdef SHOW_BOUNDING_BOX
sf::Vertex line[] =
{
sf::Vertex(sf::Vector2f(boundingBox.left, boundingBox.top)),
sf::Vertex(sf::Vector2f(boundingBox.left + boundingBox.width, boundingBox.top)),
sf::Vertex(sf::Vector2f(boundingBox.left + boundingBox.width, boundingBox.top)),
sf::Vertex(sf::Vector2f(boundingBox.left + boundingBox.width, boundingBox.top + boundingBox.height)),
sf::Vertex(sf::Vector2f(boundingBox.left + boundingBox.width, boundingBox.top + boundingBox.height)),
sf::Vertex(sf::Vector2f(boundingBox.left, boundingBox.top + boundingBox.height)),
sf::Vertex(sf::Vector2f(boundingBox.left, boundingBox.top + boundingBox.height)),
sf::Vertex(sf::Vector2f(boundingBox.left, boundingBox.top))
};
-
app->draw(line, 8, sf::Lines);
#endif
}
void BaseCreatureEntity::calculateBB()
{
}
void BaseCreatureEntity::hurt(int damages)
{
hurting = true;
hurtingDelay = HURTING_DELAY;
hp -= damages;
if (hp <= 0)
{
hp = 0;
dying();
}
}
void BaseCreatureEntity::dying()
{
isDying = true;
}

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jun 11, 11:50 AM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
68887
Default Alt Text
(3 KB)

Event Timeline