Page MenuHomePhabricator (Chris)

MagnetEntity.cpp
No OneTemporary

Authored By
Unknown
Size
844 B
Referenced Files
None
Subscribers
None

MagnetEntity.cpp

#include "MagnetEntity.h"
#include "Constants.h"
#include "sfml_game/ImageManager.h"
MagnetEntity::MagnetEntity(float x, float y, PlayerEntity* parentEntity, enumItemType itemType) : SpriteEntity (ImageManager::getInstance().getImage(IMAGE_ITEMS), x, y, ITEM_WIDTH, ITEM_HEIGHT)
{
this->x = x;
this->y = y;
this->setLifetime(0.7f);
//itemFadingEntity->setFading(true);
this->setShrinking(true);
this->setVelocity(Vector2D(150.0f - rand()%300, -260.0f));
this->setWeight(800.0f);
this->setFrame(itemType);
this->parentEntity = parentEntity;
type = ENTITY_EFFECT;
}
void MagnetEntity::animate(float delay)
{
z = y + height;
if (age > lifetime * 0.3f)
{
velocity.x += (parentEntity->getX() - x) * delay * 30.0f;
velocity.y += (parentEntity->getY() - y) * delay * 30.0f;
}
SpriteEntity::animate(delay);
}

File Metadata

Mime Type
text/x-c
Expires
Sat, Nov 14, 11:57 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
118665
Default Alt Text
MagnetEntity.cpp (844 B)

Event Timeline