The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'! https://forums.lestoria.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AdventuresInLestoria/Crawler/State_OverworldMap.cpp

38 lines
1.2 KiB

#pragma once
#include "State_OverworldMap.h"
#include "Crawler.h"
#include "DEFINES.h"
#include "Menu.h"
INCLUDE_MONSTER_LIST
INCLUDE_game
std::vector<ConnectionPoint>State_OverworldMap::connections;
State_OverworldMap::State_OverworldMap(){
SetStageMarker("Stage I-I"); //Eventually we will load the game from a file and this will not be necessary. We just set it to this for now.
}
void State_OverworldMap::OnStateChange(GameState*prevState){
Menu::CloseAllMenus();
game->GetPlayer()->SetPos(currentConnectionPoint->rect.pos);
game->GetPlayer()->UpdateWalkingAnimation(DOWN);
game->GetPlayer()->SetState(State::FORCE_WALK);
};
void State_OverworldMap::OnUserUpdate(Crawler*game){
game->camera.SetTarget(currentConnectionPoint->rect.middle());
game->UpdateCamera(game->GetElapsedTime());
game->GetPlayer()->Update(game->GetElapsedTime());
};
void State_OverworldMap::Draw(Crawler*game){
};
void State_OverworldMap::SetStageMarker(std::string connectionName){
for(ConnectionPoint&connection:connections){
if(connection.name==connectionName){
currentConnectionPoint=&connection;
return;
}
}
std::cout<<"WARNING! Could not find a connection point with name "<<connectionName<<"!"<<std::endl;
throw;
}