The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.1 KiB
34 lines
1.1 KiB
1 year ago
|
#include "DEFINES.h"
|
||
|
#include "Effect.h"
|
||
|
#include "Crawler.h"
|
||
|
|
||
|
INCLUDE_ANIMATION_DATA
|
||
|
INCLUDE_game
|
||
|
|
||
|
Effect::Effect(vf2d pos,float lifetime,AnimationState animation,float fadeout)
|
||
|
:pos(pos),lifetime(lifetime),fadeout(fadeout),original_fadeoutTime(fadeout){
|
||
|
this->animation.AddState(animation,ANIMATION_DATA[animation]);
|
||
|
}
|
||
|
|
||
|
bool Effect::Update(float fElapsedTime){
|
||
|
lifetime-=fElapsedTime;
|
||
|
if(lifetime<=0){
|
||
|
fadeout-=fElapsedTime;
|
||
|
if(fadeout<=0){
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
animation.UpdateState(internal_animState,fElapsedTime);
|
||
|
}
|
||
|
|
||
|
void Effect::Draw(){
|
||
|
if(fadeout==0){
|
||
|
game->view.DrawPartialDecal(pos-GetFrame().GetSourceRect().size/2,GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size);
|
||
|
} else {
|
||
|
game->view.DrawPartialDecal(pos-GetFrame().GetSourceRect().size/2,GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,{1,1},{255,255,255,uint8_t(fadeout/original_fadeoutTime*255)});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Animate2D::Frame Effect::GetFrame(){
|
||
|
return animation.GetFrame(internal_animState);
|
||
|
}
|