From 78b6113d8ed88f8be50486fb8da2b75ccce53b1d Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Thu, 6 Jul 2023 03:43:34 -0500 Subject: [PATCH] Added mini particles for teleporting. --- Crawler/Animation.h | 2 +- Crawler/Class.cpp | 3 +++ Crawler/Crawler.cpp | 4 ++++ Crawler/Effect.cpp | 8 ++++---- Crawler/Effect.h | 3 ++- Crawler/Version.h | 2 +- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Crawler/Animation.h b/Crawler/Animation.h index 08cf327f..d6f3b1ea 100644 --- a/Crawler/Animation.h +++ b/Crawler/Animation.h @@ -17,5 +17,5 @@ enum AnimationState{ WARRIOR_SWINGSONICSWORD_S,WARRIOR_SWINGSONICSWORD_E,WARRIOR_SWINGSONICSWORD_N,WARRIOR_SWINGSONICSWORD_W, WIZARD_IDLE_ATTACK_S,WIZARD_IDLE_ATTACK_E,WIZARD_IDLE_ATTACK_N,WIZARD_IDLE_ATTACK_W, WIZARD_ATTACK_S,WIZARD_ATTACK_E,WIZARD_ATTACK_N,WIZARD_ATTACK_W, - ENERGY_BOLT,ENERGY_PARTICLE,SPLASH_EFFECT, + ENERGY_BOLT,ENERGY_PARTICLE,SPLASH_EFFECT,DOT_PARTICLE, }; \ No newline at end of file diff --git a/Crawler/Class.cpp b/Crawler/Class.cpp index bee6837a..c037c586 100644 --- a/Crawler/Class.cpp +++ b/Crawler/Class.cpp @@ -316,6 +316,9 @@ bool Wizard::RightClickAbility(){ p.teleportTarget=teleportPoint; p.teleportStartPosition=p.GetPos(); p.iframe_time=0.35; + for(int i=0;i<16;i++){ + game->AddEffect(Effect(p.GetPos()+vf2d{(rand()%160-80)/10.f,(rand()%160-80)/10.f},float(rand()%300)/1000,AnimationState::DOT_PARTICLE,0.3,0.2,{float(rand()%1000-500)/100,float(rand()%1000-500)/100},BLACK)); + } return true; } else { p.notificationDisplay={"Cannot Teleport to that location!",0.5}; diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp index 4945b3b9..1bdc016e 100644 --- a/Crawler/Crawler.cpp +++ b/Crawler/Crawler.cpp @@ -362,6 +362,10 @@ void Crawler::InitializeAnimations(){ splash_animation.AddFrame({&GFX_Splash_Effect,{{i*24,0},{24,24}}}); } ANIMATION_DATA[AnimationState::SPLASH_EFFECT]=splash_animation; + + Animate2D::FrameSequence dot_particle; + dot_particle.AddFrame({&GFX_BulletCircle,{{0,0},{3,3}}}); + ANIMATION_DATA[AnimationState::DOT_PARTICLE]=dot_particle; } bool Crawler::LeftHeld(){ diff --git a/Crawler/Effect.cpp b/Crawler/Effect.cpp index 07934fa8..28fa3b26 100644 --- a/Crawler/Effect.cpp +++ b/Crawler/Effect.cpp @@ -5,8 +5,8 @@ INCLUDE_ANIMATION_DATA INCLUDE_game -Effect::Effect(vf2d pos,float lifetime,AnimationState animation,float size,float fadeout,vf2d spd) - :pos(pos),lifetime(lifetime),size(size),fadeout(fadeout),original_fadeoutTime(fadeout),spd(spd){ +Effect::Effect(vf2d pos,float lifetime,AnimationState animation,float size,float fadeout,vf2d spd,Pixel col) + :pos(pos),lifetime(lifetime),size(size),fadeout(fadeout),original_fadeoutTime(fadeout),spd(spd),col(col){ this->animation.AddState(animation,ANIMATION_DATA[animation]); } @@ -25,9 +25,9 @@ bool Effect::Update(float fElapsedTime){ void Effect::Draw(){ if(fadeout==0){ - game->view.DrawPartialDecal(pos-GetFrame().GetSourceRect().size/2,GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size); + game->view.DrawPartialDecal(pos-GetFrame().GetSourceRect().size/2,GetFrame().GetSourceImage()->Decal(),GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,{size,size},col); } 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)}); + game->view.DrawPartialDecal(pos-GetFrame().GetSourceRect().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)}); } } diff --git a/Crawler/Effect.h b/Crawler/Effect.h index 128af56d..1d939016 100644 --- a/Crawler/Effect.h +++ b/Crawler/Effect.h @@ -8,8 +8,9 @@ struct Effect{ float lifetime=0; float fadeout=0; float size=1; + Pixel col=WHITE; vf2d spd={}; - Effect(vf2d pos,float lifetime,AnimationState animation,float size=1.0f,float fadeout=0.0f,vf2d spd={}); + Effect(vf2d pos,float lifetime,AnimationState animation,float size=1.0f,float fadeout=0.0f,vf2d spd={},Pixel col=WHITE); bool Update(float fElapsedTime); Animate2D::Frame GetFrame(); void Draw(); diff --git a/Crawler/Version.h b/Crawler/Version.h index d0acaf8d..3fd90fb2 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 448 +#define VERSION_BUILD 451 #define stringify(a) stringify_(a) #define stringify_(a) #a