Esempio n. 1
0
void Vine::init(float px, float py, AnimatedSpriteType *sprite){
	setHitPoints(1);
	setDamage(VINE_DAMAGE);
	setSpriteType(sprite);
	setAlpha(255);
	setCurrentState(IDLE_LEFT);
	pp.setX(px);
	pp.setY(py);
	pp.setVelocity(0.0f, 0.0f);
	pp.setAccelerationX(0);
	pp.setAccelerationY(0);
	setOnTileThisFrame(false);
	setOnTileLastFrame(false);
	affixTightAABBBoundingVolume();
}
Esempio n. 2
0
void Bubble::init(float px, float py, AnimatedSpriteType *sprite){
	setHitPoints(1);
	setDamage(SEED_DAMAGE);
	setSpriteType(sprite);
	setAlpha(255);
	setCurrentState(IDLE_LEFT);
	PhysicalProperties *fireballProps = getPhysicalProperties();
	pp.setX(px);
	pp.setY(py);
	pp.setVelocity(0.0f, 0.0f);
	pp.setAccelerationX(0);
	pp.setAccelerationY(0);
	setOnTileThisFrame(false);
	setOnTileLastFrame(false);
	affixTightAABBBoundingVolume();
}
Esempio n. 3
0
void Goal::think(Game* game)
{
	float velocity = sqrtf(pp.getVelocityX()*pp.getVelocityX() + pp.getVelocityY()*pp.getVelocityY());
	if (fabsf(previousVelocity-velocity) > maxVelocity)
	{
		setSpriteType(Game::getInstance()->getGSM()->getSpriteManager()->getSpriteType(4));
		setCurrentState(L"EXPLODE");
		setIsDying(true);
		if (!pp.isDisabled())
		{
			pp.disableBox2DBody(true);
			Physics::getInstance()->destroyBody(pp.getBody());
		}
	}
	previousVelocity = velocity;
}