|
|
|
@ -2,6 +2,7 @@ |
|
|
|
|
#include "Crawler.h" |
|
|
|
|
#include "olcUTIL_Camera2D.h" |
|
|
|
|
#include "DamageNumber.h" |
|
|
|
|
#include "DEFINES.h" |
|
|
|
|
|
|
|
|
|
//192x192
|
|
|
|
|
const vi2d WINDOW_SIZE={24*8,24*8}; |
|
|
|
@ -47,7 +48,25 @@ bool Crawler::OnUserCreate(){ |
|
|
|
|
|
|
|
|
|
player.SetPos({4*24,4*24}); |
|
|
|
|
player.UpdateAnimation(AnimationState::IDLE_S); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SPAWNER_LIST.push_back(MonsterSpawner({336,96},4*24,{{{MonsterName::SLIME_BLUE,{-32,-40}},{MonsterName::SLIME_GREEN,{64,20}}}})); |
|
|
|
|
std::vector<std::pair<MonsterName,vf2d>>circleSpawn; |
|
|
|
|
for(int i=0;i<12;i++){ |
|
|
|
|
float angle=(2*PI)*(i/12.f); |
|
|
|
|
switch(i%3){ |
|
|
|
|
case 0:{ |
|
|
|
|
circleSpawn.push_back({MonsterName::SLIME_BLUE,{cos(angle)*32,sin(angle)*32}}); |
|
|
|
|
}break; |
|
|
|
|
case 1:{ |
|
|
|
|
circleSpawn.push_back({MonsterName::SLIME_GREEN,{cos(angle)*32,sin(angle)*32}}); |
|
|
|
|
}break; |
|
|
|
|
case 2:{ |
|
|
|
|
circleSpawn.push_back({MonsterName::SLIME_RED,{cos(angle)*32,sin(angle)*32}}); |
|
|
|
|
}break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
SPAWNER_LIST.push_back(MonsterSpawner({540,96},4*24,circleSpawn)); |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -321,7 +340,9 @@ void Crawler::RenderWorld(float fElapsedTime){ |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if(dn.lifeTime<DamageNumber::MOVE_UP_TIME){ |
|
|
|
|
dn.pos.y-=20*fElapsedTime; |
|
|
|
|
} |
|
|
|
|
std::string text=std::to_string(dn.damage); |
|
|
|
|
view.DrawStringPropDecal(dn.pos-GetTextSizeProp(text)/2,text,DARK_RED); |
|
|
|
|
} |
|
|
|
@ -343,6 +364,10 @@ void Crawler::AddEffect(Effect foreground,Effect background){ |
|
|
|
|
backgroundEffects.push_back(background); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
vf2d Crawler::GetWorldMousePos(){ |
|
|
|
|
return GetMousePos()+view.GetWorldOffset(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int main() |
|
|
|
|
{ |
|
|
|
|
Crawler demo; |
|
|
|
|