|
|
|
@ -61,6 +61,7 @@ bool Crawler::OnUserUpdate(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
UpdateCamera(fElapsedTime); |
|
|
|
|
RenderWorld(fElapsedTime); |
|
|
|
|
RenderHud(); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -125,7 +126,7 @@ void Crawler::InitializeAnimations(){ |
|
|
|
|
|
|
|
|
|
void Crawler::HandleUserInput(float fElapsedTime){ |
|
|
|
|
bool setIdleAnimation=true; |
|
|
|
|
if(GetKey(SPACE).bPressed&&player.GetState()==State::NORMAL){ |
|
|
|
|
if(GetKey(SPACE).bPressed&&player.GetState()==State::NORMAL&&player.GetGroundSlamCooldown()==0){ |
|
|
|
|
player.Spin(Player::GROUND_SLAM_SPIN_TIME,14*PI); |
|
|
|
|
} |
|
|
|
|
if(GetKey(RIGHT).bHeld){ |
|
|
|
@ -273,6 +274,13 @@ void Crawler::UpdateEffects(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
void Crawler::HurtEnemies(vf2d pos,float radius,int damage){ |
|
|
|
|
for(Monster&m:MONSTER_LIST){ |
|
|
|
|
if(geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){ |
|
|
|
|
m.Hurt(damage); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Crawler::RenderWorld(float fElapsedTime){ |
|
|
|
|
Clear({100,180,100}); |
|
|
|
@ -320,6 +328,16 @@ void Crawler::RenderWorld(float fElapsedTime){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Crawler::RenderHud(){ |
|
|
|
|
if(player.GetGroundSlamCooldown()>0){ |
|
|
|
|
FillRectDecal({10,ScreenHeight()-22.f},{64,6},BLACK); |
|
|
|
|
FillRectDecal({11,ScreenHeight()-21.f},{62,4},DARK_GREY); |
|
|
|
|
GradientFillRectDecal({10,ScreenHeight()-22.f},{(player.GetGroundSlamCooldown()/Player::GROUND_SLAM_COOLDOWN)*64,6},VERY_DARK_RED,VERY_DARK_RED,DARK_RED,DARK_RED); |
|
|
|
|
DrawRotatedStringPropDecal(vf2d{8,ScreenHeight()-20.f}+vf2d{1,1},"G R O U N D S L A M",-PI/64,{0,0},BLACK,{0.4,0.4}); |
|
|
|
|
DrawRotatedStringPropDecal({8,ScreenHeight()-20.f},"G R O U N D S L A M",-PI/64,{0,0},WHITE,{0.4,0.4}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Crawler::AddEffect(Effect foreground,Effect background){ |
|
|
|
|
foregroundEffects.push_back(foreground); |
|
|
|
|
backgroundEffects.push_back(background); |
|
|
|
|