Effect particles realigned and particles that are behind the center move to the back.
This commit is contained in:
parent
b1cea8d77c
commit
cdb60ac5c8
@ -341,7 +341,7 @@ void Crawler::UpdateEffects(float fElapsedTime){
|
||||
Effect*e=(*it).get();
|
||||
if(!e->Update(fElapsedTime)){
|
||||
it=backgroundEffects.erase(it);
|
||||
if(it==backgroundEffects.end()){
|
||||
if(it==backgroundEffects.end()){//In case we added effects to the vector and the vector has shifted in memory, we prematurely end.
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -350,11 +350,20 @@ void Crawler::UpdateEffects(float fElapsedTime){
|
||||
Effect*e=(*it).get();
|
||||
if(!e->Update(fElapsedTime)){
|
||||
it=foregroundEffects.erase(it);
|
||||
if(it==foregroundEffects.end()){
|
||||
if(it==foregroundEffects.end()){//In case we added effects to the vector and the vector has shifted in memory, we prematurely end.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(auto it=foregroundEffectsToBeInserted.begin();it!=foregroundEffectsToBeInserted.end();++it){
|
||||
foregroundEffects.push_back(std::move(*it));
|
||||
}
|
||||
for(auto it=backgroundEffectsToBeInserted.begin();it!=backgroundEffectsToBeInserted.end();++it){
|
||||
backgroundEffects.push_back(std::move(*it));
|
||||
}
|
||||
foregroundEffectsToBeInserted.clear();
|
||||
backgroundEffectsToBeInserted.clear();
|
||||
}
|
||||
void Crawler::UpdateBullets(float fElapsedTime){
|
||||
for(auto it=BULLET_LIST.begin();it!=BULLET_LIST.end();++it){
|
||||
@ -742,15 +751,15 @@ void Crawler::RenderHud(){
|
||||
}
|
||||
|
||||
void Crawler::AddEffect(std::unique_ptr<Effect>foreground,std::unique_ptr<Effect> background){
|
||||
foregroundEffects.push_back(std::move(foreground));
|
||||
backgroundEffects.push_back(std::move(background));
|
||||
AddEffect(std::move(background),true);
|
||||
AddEffect(std::move(foreground));
|
||||
}
|
||||
|
||||
void Crawler::AddEffect(std::unique_ptr<Effect> foreground,bool back){
|
||||
if(back){
|
||||
backgroundEffects.push_back(std::move(foreground));
|
||||
backgroundEffectsToBeInserted.push_back(std::move(foreground));
|
||||
} else {
|
||||
foregroundEffects.push_back(std::move(foreground));
|
||||
foregroundEffectsToBeInserted.push_back(std::move(foreground));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public:
|
||||
static Key KEY_ABILITY3;
|
||||
static Key KEY_ABILITY4;
|
||||
private:
|
||||
std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects;
|
||||
std::vector<std::unique_ptr<Effect>>foregroundEffects,backgroundEffects,foregroundEffectsToBeInserted,backgroundEffectsToBeInserted;
|
||||
std::map<MapName,Map>MAP_DATA;
|
||||
std::map<std::string,TilesetData>MAP_TILESETS;
|
||||
vf2d worldShake={};
|
||||
|
@ -204,7 +204,6 @@
|
||||
<ClCompile Include="Ability.cpp" />
|
||||
<ClCompile Include="Animation.cpp" />
|
||||
<ClCompile Include="Bullet.cpp" />
|
||||
<ClCompile Include="Class.cpp" />
|
||||
<ClCompile Include="Crawler.cpp" />
|
||||
<ClCompile Include="DamageNumber.cpp" />
|
||||
<ClCompile Include="Effect.cpp" />
|
||||
@ -220,8 +219,13 @@
|
||||
<ClCompile Include="Player.cpp" />
|
||||
<ClCompile Include="Monster.cpp" />
|
||||
<ClCompile Include="MonsterData.cpp" />
|
||||
<ClCompile Include="Ranger.cpp" />
|
||||
<ClCompile Include="Thief.cpp" />
|
||||
<ClCompile Include="Trapper.cpp" />
|
||||
<ClCompile Include="Warrior.cpp" />
|
||||
<ClCompile Include="utils.cpp" />
|
||||
<ClCompile Include="Witch.cpp" />
|
||||
<ClCompile Include="Wizard.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
|
@ -140,9 +140,6 @@
|
||||
<ClCompile Include="Ability.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Class.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Map.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
@ -176,6 +173,21 @@
|
||||
<ClCompile Include="Meteor.cpp">
|
||||
<Filter>Source Files\Effects</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Wizard.cpp">
|
||||
<Filter>Source Files\Player Classes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Witch.cpp">
|
||||
<Filter>Source Files\Player Classes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Trapper.cpp">
|
||||
<Filter>Source Files\Player Classes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Thief.cpp">
|
||||
<Filter>Source Files\Player Classes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Ranger.cpp">
|
||||
<Filter>Source Files\Player Classes</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="cpp.hint" />
|
||||
|
@ -16,7 +16,7 @@
|
||||
#define SETUP_CLASS(class) \
|
||||
class::class(){InitializeClassAbilities();} \
|
||||
class::class(Player*player) \
|
||||
:Player::Player(player){} \
|
||||
:Player::Player(player){InitializeClassAbilities();} \
|
||||
Class class::GetClass(){return cl;} \
|
||||
std::string class::GetClassName(){return name;} \
|
||||
Ability&class::GetRightClickAbility(){return rightClickAbility;}; \
|
||||
|
@ -14,11 +14,13 @@ bool Meteor::Update(float fElapsedTime){
|
||||
if(lifetime<=0&&!shakeField){
|
||||
shakeField=true;
|
||||
game->SetupWorldShake(2);
|
||||
for(int i=0;i<360;i++){
|
||||
float randomAngle=2*PI;
|
||||
float randomRange=192*size.x*(1-util::random(0.25))*(1-util::random(0.25));
|
||||
for(int i=0;i<650;i++){
|
||||
float randomAngle=util::random(2*PI);
|
||||
float randomRange=100*size.x*(1-util::random(0.25))*(1-util::random(0.25));
|
||||
float randomColorTintG=256-(util::random(128)+util::random(128));
|
||||
float randomColorTint=util::random(128);
|
||||
game->AddEffect(std::make_unique<Effect>(pos+vf2d{cos(randomAngle),sin(randomAngle)}*randomRange,0,AnimationState::DOT_PARTICLE,OnUpperLevel(),vf2d{util::random(2),util::random(3)},util::random(3)+1,vf2d{util::random(4)-2,-util::random(4)},Pixel{255,uint8_t(randomColorTint),uint8_t(randomColorTint),uint8_t(util::random(128)+128)},0,0,true));
|
||||
vf2d effectPos=pos+vf2d{cos(randomAngle),sin(randomAngle)}*randomRange-vf2d{0,GetFrame().GetSourceRect().size.y/2.f};
|
||||
game->AddEffect(std::make_unique<Effect>(effectPos,0,AnimationState::DOT_PARTICLE,OnUpperLevel(),vf2d{util::random(2)+1,util::random(3)+1},util::random(3)+1,vf2d{util::random(10)-5,-util::random(20)-5},Pixel{255,uint8_t(randomColorTintG),uint8_t(randomColorTint),uint8_t(util::random(128)+128)},0,0,true),effectPos.y<(pos-vf2d{0,GetFrame().GetSourceRect().size.y/2.f}).y);
|
||||
}
|
||||
}
|
||||
return Effect::Update(fElapsedTime);
|
||||
|
@ -20,8 +20,8 @@ Player::Player()
|
||||
:state(State::NORMAL),lastReleasedMovementKey(DOWN),facingDirection(DOWN){}
|
||||
|
||||
Player::Player(Player*player)
|
||||
:pos(player->GetPos()),vel(player->GetVelocity()),iframe_time(player->iframe_time),lastReleasedMovementKey(player->GetLastReleasedMovementKey()),
|
||||
facingDirection(GetFacingDirection()){}
|
||||
:pos(player->GetPos()),vel(player->GetVelocity()),iframe_time(player->iframe_time),lastReleasedMovementKey(DOWN),
|
||||
facingDirection(DOWN),state(State::NORMAL){}
|
||||
|
||||
bool Player::SetX(float x){
|
||||
vf2d newPos={x,pos.y};
|
||||
|
@ -67,7 +67,7 @@ protected:
|
||||
bool upperLevel=false;
|
||||
vf2d vel={0,0};
|
||||
float attack_range=1.5f;
|
||||
Key facingDirection;
|
||||
Key facingDirection=DOWN;
|
||||
float swordSwingTimer=0;
|
||||
void CastSpell(Ability&ability);
|
||||
Ability*castPrepAbility;
|
||||
|
@ -2,7 +2,7 @@
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 662
|
||||
#define VERSION_BUILD 686
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
Loading…
x
Reference in New Issue
Block a user