|
|
|
#include "BulletTypes.h"
|
|
|
|
#include "Effect.h"
|
|
|
|
#include "Crawler.h"
|
|
|
|
#include "DEFINES.h"
|
|
|
|
#include "utils.h"
|
|
|
|
|
|
|
|
INCLUDE_game
|
|
|
|
|
|
|
|
EnergyBolt::EnergyBolt(vf2d pos,vf2d vel,float radius,int damage,bool friendly,Pixel col)
|
|
|
|
:Bullet(pos,vel,radius,damage,AnimationState::ENERGY_BOLT,false,INFINITE,true,friendly,col){}
|
|
|
|
|
|
|
|
void EnergyBolt::Update(float fElapsedTime){
|
|
|
|
lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime);
|
|
|
|
if(lastParticleSpawn==0){
|
|
|
|
lastParticleSpawn=0.03;
|
|
|
|
game->AddEffect(Effect(pos,util::random(1),AnimationState::ENERGY_PARTICLE,util::random(2),0.5,{util::random(60)-30,util::random(60)-30}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EnergyBolt::PlayerHit(Player& player)
|
|
|
|
{
|
|
|
|
deactivated=true;
|
|
|
|
fadeOutTime=0.2f;
|
|
|
|
game->AddEffect(Effect(player.GetPos(),0,AnimationState::SPLASH_EFFECT,player.GetSizeMult(),0.25));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EnergyBolt::MonsterHit(Monster& monster)
|
|
|
|
{
|
|
|
|
deactivated=true;
|
|
|
|
fadeOutTime=0.2f;
|
|
|
|
game->AddEffect(Effect(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,monster.GetSizeMult(),0.25));
|
|
|
|
return false;
|
|
|
|
}
|