Fix Damage Number flickering, add in extra projectile ring when king slime lands for phase 1. Phase 1 complete.

pull/28/head
sigonasr2 1 year ago
parent 43b5503661
commit cb600c8ea4
  1. 13
      Crawler/Crawler.cpp
  2. 1
      Crawler/Monster.cpp
  3. 2
      Crawler/Monster.h
  4. 9
      Crawler/SlimeKing.cpp
  5. 2
      Crawler/Version.h

@ -378,6 +378,7 @@ void Crawler::UpdateEffects(float fElapsedTime){
std::erase_if(EMITTER_LIST,[](std::unique_ptr<Emitter>&e){return e->dead;});
std::erase_if(backgroundEffects,[](std::unique_ptr<Effect>&e){return e->dead;});
std::erase_if(foregroundEffects,[](std::unique_ptr<Effect>&e){return e->dead;});
std::erase_if(DAMAGENUMBER_LIST,[](std::shared_ptr<DamageNumber>&n){return n->lifeTime>1;});
for(auto it=foregroundEffectsToBeInserted.begin();it!=foregroundEffectsToBeInserted.end();++it){
foregroundEffects.push_back(std::move(*it));
@ -674,6 +675,10 @@ void Crawler::RenderWorld(float fElapsedTime){
#pragma endregion
//DrawDecal({0,0},MAP_TILESETS["assets/maps/"+MAP_DATA[LEVEL1].TilesetData[1].data["source"]]->Decal());
for(Monster&m:MONSTER_LIST){
m.strategyDraw(this);
}
if(player->GetZ()>0){
vf2d shadowScale=vf2d{8*player->GetSizeMult()/3.f,1}/std::max(1.f,player->GetZ()/24);
view.DrawDecal(player->GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*player->GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
@ -803,16 +808,10 @@ void Crawler::RenderWorld(float fElapsedTime){
dn->pauseTime-=fElapsedTime;
} else{
dn->lifeTime+=fElapsedTime;
if(dn->lifeTime>1){
it=DAMAGENUMBER_LIST.erase(it);
if(it==DAMAGENUMBER_LIST.end()){
break;
}
} else {
if(dn->lifeTime<=1){
if(dn->lifeTime<DamageNumber::MOVE_UP_TIME){
dn->pos.y-=20*fElapsedTime;
}
}
}
std::string text=std::to_string(dn->damage);

@ -184,7 +184,6 @@ Key Monster::GetFacingDirection(){
return facingDirection;
}
void Monster::Draw(){
strategyDraw(game);
if(GetZ()>0){
vf2d shadowScale=vf2d{8*GetSizeMult()/3.f,1}/std::max(1.f,GetZ()/24);
game->view.DrawDecal(GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);

@ -92,7 +92,6 @@ private:
bool diesNormally=true; //If set to false, the monster death is handled in a special way. Set it to true when it's time to die.
float targetSize=0;
std::map<Attribute,std::variant<VARIANTS>>attributes;
std::function<void(Crawler*)>strategyDraw=[](Crawler*pge){};
protected:
public:
Monster()=delete;
@ -146,6 +145,7 @@ public:
bool&GetBool(Attribute a);
vf2d&GetVf2d(Attribute a);
void SetStrategyDrawFunction(std::function<void(Crawler*)>func);
std::function<void(Crawler*)>strategyDraw=[](Crawler*pge){};
private:
struct STRATEGY{
static int _GetInt(Monster&m,std::string param,int strategyNumber,int index=0);

@ -15,6 +15,7 @@ typedef Attribute A;
void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumber){
float bulletSpd=ConfigFloat("BulletSpd")/100*24;
m.F(A::SHOOT_RING_TIMER)=std::max(0.f,m.F(A::SHOOT_RING_TIMER)-fElapsedTime);
@ -28,6 +29,13 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
BULLET_LIST.emplace_back(std::make_unique<Bullet>(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6}));
}
};
auto Landed=[&ShootBulletRing,&m](int currentPhase){
if(currentPhase==1){
ShootBulletRing(m.F(A::SHOOT_RING_OFFSET));
}
};
auto StartJump=[&](float jumpDuration,vf2d targetPos,float recoveryTime){
m.V(A::JUMP_ORIGINAL_POS)=m.GetPos();
m.F(A::JUMP_ORIGINAL_LANDING_TIMER)=m.F(A::JUMP_LANDING_TIMER)=jumpDuration;
@ -80,6 +88,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
}
game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*ConfigInt("JumpKnockbackFactor"));
}
Landed(m.phase);
m.SetStrategyDrawFunction([](Crawler*game){});
} else
if(m.F(A::JUMP_LANDING_TIMER)<=ConfigFloat("JumpWarningIndicatorTime")){

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 1330
#define VERSION_BUILD 1334
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save