Fix bug with multi-target bullets fading out upon hitting a single target. Reduce default fade time of bullets from 0.25 seconds to 0.1 seconds. Release Build 10024.
This commit is contained in:
parent
421ba4bc4a
commit
ed5ab319de
@ -59,8 +59,7 @@ Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,std::string animation,b
|
|||||||
Animate2D::Frame Bullet::GetFrame()const{
|
Animate2D::Frame Bullet::GetFrame()const{
|
||||||
return animation.GetFrame(internal_animState);
|
return animation.GetFrame(internal_animState);
|
||||||
}
|
}
|
||||||
void Bullet::UpdateFadeTime(float fElapsedTime)
|
void Bullet::UpdateFadeTime(float fElapsedTime){
|
||||||
{
|
|
||||||
aliveTime+=fElapsedTime;
|
aliveTime+=fElapsedTime;
|
||||||
if(fadeInTime>0){
|
if(fadeInTime>0){
|
||||||
if(fadeInTimer<fadeInTime){
|
if(fadeInTimer<fadeInTime){
|
||||||
@ -129,19 +128,22 @@ void Bullet::_Update(const float fElapsedTime){
|
|||||||
|
|
||||||
while(iterations>0){
|
while(iterations>0){
|
||||||
iterations--;
|
iterations--;
|
||||||
|
if(IsPlayerAutoAttackProjectile()){pos+=(game->GetWindSpeed()*game->GetElapsedTime())/float(totalIterations);}
|
||||||
pos+=(vel*fElapsedTime)/float(totalIterations);
|
pos+=(vel*fElapsedTime)/float(totalIterations);
|
||||||
if(!CollisionCheck()){
|
if(!CollisionCheck()){
|
||||||
return;
|
goto DeadBulletCheck;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos=finalBulletPos;
|
pos=finalBulletPos;
|
||||||
if(!CollisionCheck()){
|
if(!CollisionCheck()){
|
||||||
return;
|
goto DeadBulletCheck;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
|
if(IsPlayerAutoAttackProjectile()){pos+=game->GetWindSpeed()*game->GetElapsedTime();}
|
||||||
pos+=vel*fElapsedTime;
|
pos+=vel*fElapsedTime;
|
||||||
}
|
}
|
||||||
if(IsPlayerAutoAttackProjectile()){pos+=game->GetWindSpeed()*game->GetElapsedTime();}
|
|
||||||
|
DeadBulletCheck:
|
||||||
if(/*World size in PIXELS!*/vi2d worldSize=game->GetCurrentMapData().MapSize*game->GetCurrentMapData().TileSize;pos.x+radius<-WINDOW_SIZE.x||pos.x-radius>worldSize.x+WINDOW_SIZE.x||pos.y+radius<-WINDOW_SIZE.y||pos.y-radius>worldSize.y+WINDOW_SIZE.y){
|
if(/*World size in PIXELS!*/vi2d worldSize=game->GetCurrentMapData().MapSize*game->GetCurrentMapData().TileSize;pos.x+radius<-WINDOW_SIZE.x||pos.x-radius>worldSize.x+WINDOW_SIZE.x||pos.y+radius<-WINDOW_SIZE.y||pos.y-radius>worldSize.y+WINDOW_SIZE.y){
|
||||||
dead=true;
|
dead=true;
|
||||||
return;
|
return;
|
||||||
@ -194,11 +196,11 @@ BulletDestroyState Bullet::_MonsterHit(Monster&monster){
|
|||||||
return destroyBullet;
|
return destroyBullet;
|
||||||
}
|
}
|
||||||
BulletDestroyState Bullet::PlayerHit(Player*player){
|
BulletDestroyState Bullet::PlayerHit(Player*player){
|
||||||
fadeOutTime=0.25f;
|
if(!hitsMultiple)fadeOutTime=0.1f;
|
||||||
return BulletDestroyState::KEEP_ALIVE;
|
return BulletDestroyState::KEEP_ALIVE;
|
||||||
}
|
}
|
||||||
BulletDestroyState Bullet::MonsterHit(Monster&monster){
|
BulletDestroyState Bullet::MonsterHit(Monster&monster){
|
||||||
fadeOutTime=0.25f;
|
if(!hitsMultiple)fadeOutTime=0.1f;
|
||||||
return BulletDestroyState::KEEP_ALIVE;
|
return BulletDestroyState::KEEP_ALIVE;
|
||||||
}
|
}
|
||||||
bool Bullet::OnUpperLevel(){return upperLevel;}
|
bool Bullet::OnUpperLevel(){return upperLevel;}
|
||||||
|
@ -63,7 +63,7 @@ struct Bullet{
|
|||||||
bool hitsMultiple=false;
|
bool hitsMultiple=false;
|
||||||
bool rotates=false;
|
bool rotates=false;
|
||||||
bool animated=false;
|
bool animated=false;
|
||||||
float fadeOutTime=0; //Setting the fade out time causes the bullet's lifetime to be set to the fadeout time as well, as that's when the bullet's alpha will reach 0, so it dies.
|
float fadeOutTime=0.f; //Setting the fade out time causes the bullet's lifetime to be set to the fadeout time as well, as that's when the bullet's alpha will reach 0, so it dies.
|
||||||
bool friendly=false; //Whether or not it's a player bullet or enemy bullet.
|
bool friendly=false; //Whether or not it's a player bullet or enemy bullet.
|
||||||
bool upperLevel=false;
|
bool upperLevel=false;
|
||||||
bool alwaysOnTop=false;
|
bool alwaysOnTop=false;
|
||||||
|
@ -89,10 +89,12 @@ void DaggerSlash::Update(float fElapsedTime){
|
|||||||
BulletDestroyState DaggerSlash::PlayerHit(Player*player){
|
BulletDestroyState DaggerSlash::PlayerHit(Player*player){
|
||||||
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}));
|
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}));
|
||||||
player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt);
|
player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt);
|
||||||
|
Deactivate();
|
||||||
return BulletDestroyState::KEEP_ALIVE;
|
return BulletDestroyState::KEEP_ALIVE;
|
||||||
}
|
}
|
||||||
BulletDestroyState DaggerSlash::MonsterHit(Monster&monster){
|
BulletDestroyState DaggerSlash::MonsterHit(Monster&monster){
|
||||||
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}));
|
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}));
|
||||||
monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt);
|
monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt);
|
||||||
|
Deactivate();
|
||||||
return BulletDestroyState::KEEP_ALIVE;
|
return BulletDestroyState::KEEP_ALIVE;
|
||||||
}
|
}
|
@ -95,10 +95,12 @@ void DaggerStab::Update(float fElapsedTime){
|
|||||||
BulletDestroyState DaggerStab::PlayerHit(Player*player){
|
BulletDestroyState DaggerStab::PlayerHit(Player*player){
|
||||||
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}));
|
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}));
|
||||||
player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt);
|
player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt);
|
||||||
|
Deactivate();
|
||||||
return BulletDestroyState::KEEP_ALIVE;
|
return BulletDestroyState::KEEP_ALIVE;
|
||||||
}
|
}
|
||||||
BulletDestroyState DaggerStab::MonsterHit(Monster&monster){
|
BulletDestroyState DaggerStab::MonsterHit(Monster&monster){
|
||||||
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}));
|
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}));
|
||||||
monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt);
|
monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt);
|
||||||
|
Deactivate();
|
||||||
return BulletDestroyState::KEEP_ALIVE;
|
return BulletDestroyState::KEEP_ALIVE;
|
||||||
}
|
}
|
@ -50,7 +50,7 @@ enum class EffectType{
|
|||||||
|
|
||||||
struct Effect{
|
struct Effect{
|
||||||
friend class AiL;
|
friend class AiL;
|
||||||
friend class FallingStone;
|
friend struct FallingStone;
|
||||||
vf2d pos={0,0};
|
vf2d pos={0,0};
|
||||||
float lifetime=0;
|
float lifetime=0;
|
||||||
float fadeout=0;
|
float fadeout=0;
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 3
|
#define VERSION_PATCH 3
|
||||||
#define VERSION_BUILD 10015
|
#define VERSION_BUILD 10024
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user