|
|
|
@ -115,6 +115,12 @@ void Crawler::InitializeAnimations(){ |
|
|
|
|
|
|
|
|
|
void Crawler::HandleUserInput(float fElapsedTime){ |
|
|
|
|
bool setIdleAnimation=true; |
|
|
|
|
if(GetKey(PGUP).bHeld){ |
|
|
|
|
player.SetZ(player.GetZ()+5*fElapsedTime); |
|
|
|
|
} |
|
|
|
|
if(GetKey(PGDN).bHeld){ |
|
|
|
|
player.SetZ(std::max(0.f,player.GetZ()-5*fElapsedTime)); |
|
|
|
|
} |
|
|
|
|
if(GetKey(RIGHT).bHeld){ |
|
|
|
|
if(player.GetPos().x+12+fElapsedTime*100*player.GetMoveSpdMult()<WORLD_SIZE.x*24){ |
|
|
|
|
player.SetX(player.GetX()+fElapsedTime*100*player.GetMoveSpdMult()); |
|
|
|
@ -249,11 +255,14 @@ void Crawler::RenderWorld(float fElapsedTime){ |
|
|
|
|
std::copy_if(MONSTER_LIST.begin(),MONSTER_LIST.end(),std::back_inserter(monstersAfter),[&pl](Monster&m){return m.GetPos().y>=pl.GetPos().y;}); |
|
|
|
|
std::sort(monstersBefore.begin(),monstersBefore.end(),[](Monster&m1,Monster&m2){return m1.GetPos().y<m2.GetPos().y;}); |
|
|
|
|
std::sort(monstersAfter.begin(),monstersAfter.end(),[](Monster&m1,Monster&m2){return m1.GetPos().y<m2.GetPos().y;}); |
|
|
|
|
view.DrawDecal(player.GetPos()+vf2d{-12,12-4},GFX_Circle.Decal(),{24/3,1}); |
|
|
|
|
if(player.GetZ()>0){ |
|
|
|
|
vf2d shadowScale=vf2d{8/3.f,1}/std::max(1.f,player.GetZ()/4); |
|
|
|
|
view.DrawDecal(player.GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6},GFX_Circle.Decal(),shadowScale); |
|
|
|
|
} |
|
|
|
|
for(Monster&m:monstersBefore){ |
|
|
|
|
view.DrawPartialDecal(m.GetPos()-vf2d{12,12}*m.GetSizeMult(),m.GetFrame().GetSourceImage()->Decal(),m.GetFrame().GetSourceRect().pos,m.GetFrame().GetSourceRect().size,vf2d(m.GetSizeMult(),m.GetSizeMult())); |
|
|
|
|
} |
|
|
|
|
view.DrawPartialDecal(player.GetPos()-vf2d{12,12}*player.GetSizeMult(),player.GetFrame().GetSourceImage()->Decal(),player.GetFrame().GetSourceRect().pos,player.GetFrame().GetSourceRect().size,vf2d(player.GetSizeMult(),player.GetSizeMult())); |
|
|
|
|
view.DrawPartialDecal(player.GetPos()-vf2d{12,12}*player.GetSizeMult()+vf2d{0,-player.GetZ()},player.GetFrame().GetSourceImage()->Decal(),player.GetFrame().GetSourceRect().pos,player.GetFrame().GetSourceRect().size,vf2d(player.GetSizeMult(),player.GetSizeMult())); |
|
|
|
|
for(Monster&m:monstersAfter){ |
|
|
|
|
view.DrawPartialDecal(m.GetPos()-vf2d{12,12}*m.GetSizeMult(),m.GetFrame().GetSourceImage()->Decal(),m.GetFrame().GetSourceRect().pos,m.GetFrame().GetSourceRect().size,vf2d(m.GetSizeMult(),m.GetSizeMult())); |
|
|
|
|
} |
|
|
|
|