Update Stage Plates to include the level type. Created Overworld Menu, and Initialized Character Menu. Story and shops no longer have the change loadout buttons.
This commit is contained in:
@@ -85,34 +85,41 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
|
||||
}
|
||||
}
|
||||
|
||||
for(ConnectionPoint&cp:connections){
|
||||
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){
|
||||
for(int neighborInd:currentConnectionPoint->neighbors){
|
||||
if(neighborInd==-1)continue;
|
||||
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
|
||||
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&&cp==&neighbor){
|
||||
currentConnectionPoint=&neighbor;
|
||||
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
||||
float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos);
|
||||
if(angleTo>=-3*PI/4&&angleTo<-PI/4){
|
||||
game->GetPlayer()->UpdateWalkingAnimation(UP);
|
||||
}else
|
||||
if(angleTo<PI/4&&angleTo>=-PI/4){
|
||||
game->GetPlayer()->UpdateWalkingAnimation(RIGHT);
|
||||
}else
|
||||
if(angleTo>=PI/4&&angleTo<3*PI/4){
|
||||
game->GetPlayer()->UpdateWalkingAnimation(DOWN);
|
||||
}else{
|
||||
game->GetPlayer()->UpdateWalkingAnimation(LEFT);
|
||||
if(Crawler::KEY_MENU.Pressed()){
|
||||
Menu::OpenMenu(OVERWORLD_MENU);
|
||||
}
|
||||
|
||||
#pragma region Handle Connection Point Clicking and Movement
|
||||
for(ConnectionPoint&cp:connections){
|
||||
if(game->GetMouse(Mouse::LEFT).bPressed&&geom2d::overlaps(game->GetWorldMousePos(),cp.rect)){
|
||||
for(int neighborInd:currentConnectionPoint->neighbors){
|
||||
if(neighborInd==-1)continue;
|
||||
ConnectionPoint&neighbor=ConnectionPointFromIndex(neighborInd);
|
||||
if(Unlock::IsUnlocked(neighbor.unlockCondition)&&&cp==&neighbor){
|
||||
currentConnectionPoint=&neighbor;
|
||||
playerTargetPos=currentConnectionPoint->rect.pos+currentConnectionPoint->rect.size/2+vf2d{0,16};
|
||||
float angleTo=util::angleTo(game->GetPlayer()->GetPos(),playerTargetPos);
|
||||
if(angleTo>=-3*PI/4&&angleTo<-PI/4){
|
||||
game->GetPlayer()->UpdateWalkingAnimation(UP);
|
||||
}else
|
||||
if(angleTo<PI/4&&angleTo>=-PI/4){
|
||||
game->GetPlayer()->UpdateWalkingAnimation(RIGHT);
|
||||
}else
|
||||
if(angleTo>=PI/4&&angleTo<3*PI/4){
|
||||
game->GetPlayer()->UpdateWalkingAnimation(DOWN);
|
||||
}else{
|
||||
game->GetPlayer()->UpdateWalkingAnimation(LEFT);
|
||||
}
|
||||
Component<MenuLabel>(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
|
||||
Component<EncountersSpawnListScrollableWindowComponent>(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
|
||||
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
|
||||
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Change Loadout Button")->Enable(!(currentConnectionPoint->type=="STORY"||currentConnectionPoint->type=="SHOP"));
|
||||
break;
|
||||
}
|
||||
Component<MenuLabel>(OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
|
||||
Component<EncountersSpawnListScrollableWindowComponent>(OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
|
||||
Component<MenuComponent>(OVERWORLD_LEVEL_SELECT,"Enter Button")->Enable(currentConnectionPoint->levelDataExists);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
};
|
||||
void State_OverworldMap::Draw(Crawler*game){
|
||||
currentTime+=game->GetElapsedTime();
|
||||
|
||||
Reference in New Issue
Block a user