Made map data xml tag more specific (output width and height as values). Add load level functionality, changes world size.
This commit is contained in:
+12
-1
@@ -133,6 +133,8 @@ bool Crawler::OnUserCreate(){
|
||||
,{MonsterName::SLIME_BLUE,{(rand()%20/2.f-5)*24,(rand()%20/2.f-5)*24}}
|
||||
}}));
|
||||
|
||||
LoadLevel(CAMPAIGN_1_1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -655,6 +657,7 @@ void Crawler::RenderWorld(float fElapsedTime){
|
||||
}
|
||||
}
|
||||
}
|
||||
//DrawDecal({0,0},MAP_TILESETS["assets/maps/"+MAP_DATA[LEVEL1].TilesetData[1].data["source"]]->Decal());
|
||||
std::vector<Monster>monstersBefore,monstersAfter;
|
||||
Player&pl=player;
|
||||
std::copy_if(MONSTER_LIST.begin(),MONSTER_LIST.end(),std::back_inserter(monstersBefore),[&pl](Monster&m){return m.GetPos().y<pl.GetPos().y;});
|
||||
@@ -771,7 +774,6 @@ void Crawler::RenderHud(){
|
||||
DrawStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4 - vf2d{ 0.4,0 }, versionStr, WHITE, { 0.4,0.4 });
|
||||
DrawStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4 - vf2d{ 0,0.4 }, versionStr, WHITE, { 0.4,0.4 });
|
||||
DrawStringDecal(vf2d{ GetScreenSize() } - vf2d{ GetTextSize(versionStr) }*0.4, versionStr, BLACK,{0.4,0.4});
|
||||
DrawDecal({0,0},MAP_TILESETS["assets/maps/"+MAP_DATA[LEVEL1].TilesetData[1].data["source"]]->Decal());
|
||||
}
|
||||
|
||||
void Crawler::AddEffect(Effect foreground,Effect background){
|
||||
@@ -811,6 +813,15 @@ void Crawler::InitializeLevel(std::string mapFile,MapName map){
|
||||
}
|
||||
}
|
||||
|
||||
void Crawler::LoadLevel(MapName map){
|
||||
currentLevel=map;
|
||||
WORLD_SIZE={MAP_DATA[map].MapData.width,MAP_DATA[map].MapData.height};
|
||||
}
|
||||
|
||||
vi2d Crawler::GetWorldSize(){
|
||||
return WORLD_SIZE;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
Crawler demo;
|
||||
|
||||
Reference in New Issue
Block a user