Added lightning bolt attack, added emitter system

This commit is contained in:
2023-07-12 00:23:36 -05:00
parent e172483cc6
commit 0229982717
26 changed files with 553 additions and 294 deletions
+12 -4
View File
@@ -5,8 +5,13 @@
INCLUDE_ANIMATION_DATA
INCLUDE_game
Effect::Effect(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col)
:pos(pos),lifetime(lifetime),upperLevel(upperLevel),size(size),fadeout(fadeout),original_fadeoutTime(fadeout),spd(spd),col(col){
Effect::Effect(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:Effect::Effect(pos,lifetime,animation,upperLevel,{size,size},fadeout,spd,col,rotation,rotationSpd,additiveBlending){
this->animation.AddState(animation,ANIMATION_DATA[animation]);
}
Effect::Effect(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,vf2d size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:pos(pos),lifetime(lifetime),upperLevel(upperLevel),size(size),fadeout(fadeout),original_fadeoutTime(fadeout),spd(spd),col(col),rotation(rotation),rotationSpd(rotationSpd),additiveBlending(additiveBlending){
this->animation.AddState(animation,ANIMATION_DATA[animation]);
}
@@ -18,16 +23,19 @@ bool Effect::Update(float fElapsedTime){
return false;
}
}
rotation+=rotationSpd*fElapsedTime;
pos+=spd*fElapsedTime;
animation.UpdateState(internal_animState,fElapsedTime);
return true;
}
void Effect::Draw(){
if(additiveBlending)game->SetDecalMode(DecalMode::ADDITIVE);
else game->SetDecalMode(DecalMode::NORMAL);
if(fadeout==0){
game->view.DrawPartialDecal(pos-GetFrame().GetSourceRect().size*size/2,GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,{size,size},col);
game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,col);
} else {
game->view.DrawPartialDecal(pos-GetFrame().GetSourceRect().size*size/2,GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,{size,size},{col.r,col.g,col.b,uint8_t(fadeout/original_fadeoutTime*255)});
game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,{col.r,col.g,col.b,uint8_t(fadeout/original_fadeoutTime*255)});
}
}