Teleport code added in Wizard. Needs more debugging.

This commit is contained in:
2023-07-05 04:31:31 -05:00
parent ba6bc74f1f
commit 888d2a91a6
6 changed files with 58 additions and 17 deletions
+8 -4
View File
@@ -107,11 +107,10 @@ bool Crawler::OnUserCreate(){
player.AddAnimation(AnimationState::WIZARD_ATTACK_W);
view=TileTransformedView{GetScreenSize(),{1,1}};
player.SetClass(WARRIOR);
player.SetPos({4*24,4*24});
LoadLevel(CAMPAIGN_1_1);
player.SetClass(WARRIOR);
return true;
}
@@ -875,7 +874,6 @@ void Crawler::LoadLevel(MapName map){
SPAWNER_LIST.clear();
foregroundTileGroups.clear();
currentLevel=map;
player.SetPos(MAP_DATA[map].MapData.playerSpawnLocation);
WORLD_SIZE={MAP_DATA[map].MapData.width,MAP_DATA[map].MapData.height};
for(SpawnerTag&spawner:MAP_DATA[map].SpawnerData){
std::vector<std::pair<MonsterName,vf2d>>monster_list;
@@ -919,6 +917,7 @@ void Crawler::LoadLevel(MapName map){
}
}
}
player.SetPos(MAP_DATA[map].MapData.playerSpawnLocation);
}
vi2d Crawler::GetWorldSize(){
@@ -949,6 +948,11 @@ TilesheetData Crawler::GetTileSheet(MapName map,int tileID){
}
}
bool Crawler::HasTileCollision(MapName map,vf2d pos){
geom2d::rect<int>collisionRect=GetTileCollision(map,pos);
return collisionRect.pos==NO_COLLISION.pos&&collisionRect.size==NO_COLLISION.size;
}
geom2d::rect<int>Crawler::GetTileCollision(MapName map,vf2d pos){
for(LayerTag&layer:MAP_DATA[map].LayerData){
int tileID=layer.tiles[int(pos.y)/24][int(pos.x)/24]-1;