Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F126046
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/FallingRockEntity.cpp b/src/FallingRockEntity.cpp
index 2dbca4b..659f15f 100644
--- a/src/FallingRockEntity.cpp
+++ b/src/FallingRockEntity.cpp
@@ -1,114 +1,114 @@
#include "FallingRockEntity.h"
#include "PlayerEntity.h"
#include "sfml_game/SpriteEntity.h"
#include "sfml_game/ImageManager.h"
#include "sfml_game/SoundManager.h"
#include "Constants.h"
#include "WitchBlastGame.h"
FallingRockEntity::FallingRockEntity(float x, float y, int rockType)
: EnnemyEntity (ImageManager::getImageManager()->getImage(IMAGE_CYCLOP), x, y)
{
Vector2D targetPos = game().getPlayerPosition();
imagesProLine = 20;
type = ENTITY_ENNEMY;
movingStyle = movFlying;
bloodColor = bloodNone; // stones don't bleed
age = 0.0f;
h = 1800 + rand() % 1000;
hp = 24;
this->rockType = rockType;
switch (rockType)
{
case 0: meleeDamages = 8; frame = 18; break;
case 1: meleeDamages = 10; frame = 38; break;
case 2: meleeDamages = 12; frame = 58; break;
}
}
void FallingRockEntity::animate(float delay)
{
- h -= delay * 800.0f;
+ h -= delay * 750.0f;
if (canCollide()) testSpriteCollisions();
if (h <= 0.0f) dying();
}
void FallingRockEntity::render(sf::RenderTarget* app)
{
int nx = frame % imagesProLine;
int ny = frame / imagesProLine;
// shadow
if (h <= 1600)
{
int f = 1600 - h;
if (f > 255) f = 255;
sprite.setColor(sf::Color(255, 255, 255, f));
sprite.setPosition(x, y);
sprite.setTextureRect(sf::IntRect((nx + 1) * width, ny * height, width, height));
app->draw(sprite);
sprite.setColor(sf::Color(255, 255, 255, 255));
}
sprite.setPosition(x, y - h);
sprite.setTextureRect(sf::IntRect(nx * width, ny * height, width, height));
app->draw(sprite);
#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 FallingRockEntity::calculateBB()
{
int w = 30;
if (rockType == 1) w = 40;
else if (rockType == 2) w = 50;
boundingBox.left = (int)x - w / 2;
boundingBox.width = w;
boundingBox.top = (int)y - w / 2;
boundingBox.height = w;
}
bool FallingRockEntity::canCollide()
{
- return h < 50;
+ return h < 70;
}
void FallingRockEntity::dying()
{
isDying = true;
SoundManager::getSoundManager()->playSound(SOUND_ROCK_IMPACT);
game().makeShake(0.1f);
for (int i = 0; i < 4; i++)
{
SpriteEntity* blood = new SpriteEntity(ImageManager::getImageManager()->getImage(IMAGE_BLOOD), x, y, 16, 16, 6);
blood->setZ(OFFSET_Y - 1);
blood->setFrame(12 + rand()%6);
blood->setType(ENTITY_BLOOD);
blood->setVelocity(Vector2D(rand()%150));
blood->setViscosity(0.95f);
float bloodScale = 1.0f + (rand() % 10) * 0.1f;
blood->setScale(bloodScale, bloodScale);
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Jun 11, 10:29 AM (3 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
68418
Default Alt Text
(3 KB)
Attached To
Mode
R78 witchblast
Attached
Detach File
Event Timeline