Update sprites for second boss, add config parameters for new behavior.
Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
This commit is contained in:
parent
aa39b1b855
commit
1046557ac0
@ -88,14 +88,14 @@ void Monster::STRATEGY::BEAR(Monster&m,float fElapsedTime,std::string strategy){
|
|||||||
if(geom2d::overlaps(attackCircle,game->GetPlayer()->Hitbox())){
|
if(geom2d::overlaps(attackCircle,game->GetPlayer()->Hitbox())){
|
||||||
if(game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),0.f)){
|
if(game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),0.f)){
|
||||||
game->GetPlayer()->Knockup(ConfigFloat("Attack Knockup Duration"));
|
game->GetPlayer()->Knockup(ConfigFloat("Attack Knockup Duration"));
|
||||||
vf2d playerDirVecNorm=geom2d::line<float>(m.V(A::LOCKON_POS),game->GetPlayer()->GetPos()).vector().norm();
|
vf2d playerDirVecNorm=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).vector().norm();
|
||||||
game->GetPlayer()->Knockback(playerDirVecNorm*ConfigFloat("Attack Knockback Amount"));
|
game->GetPlayer()->Knockback(playerDirVecNorm*ConfigFloat("Attack Knockback Amount"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(Monster&otherM:MONSTER_LIST){
|
for(Monster&otherM:MONSTER_LIST){
|
||||||
if(!otherM.AttackAvoided(m.GetZ())&&&m!=&otherM&&geom2d::overlaps(attackCircle,otherM.Hitbox())){
|
if(!otherM.AttackAvoided(m.GetZ())&&&m!=&otherM&&geom2d::overlaps(attackCircle,otherM.Hitbox())){
|
||||||
otherM.Knockup(ConfigFloat("Attack Knockup Duration"));
|
otherM.Knockup(ConfigFloat("Attack Knockup Duration"));
|
||||||
vf2d monsterDirVecNorm=geom2d::line<float>(m.V(A::LOCKON_POS),otherM.GetPos()).vector().norm();
|
vf2d monsterDirVecNorm=geom2d::line<float>(m.GetPos(),otherM.GetPos()).vector().norm();
|
||||||
game->GetPlayer()->Knockback(monsterDirVecNorm*ConfigFloat("Attack Knockback Amount"));
|
game->GetPlayer()->Knockback(monsterDirVecNorm*ConfigFloat("Attack Knockback Amount"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,9 @@ const void SaveFile::SaveGame(){
|
|||||||
|
|
||||||
utils::datafile::INITIAL_SETUP_COMPLETE=true;
|
utils::datafile::INITIAL_SETUP_COMPLETE=true;
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
|
if(onlineMode){
|
||||||
std::stringstream fileContents;
|
std::stringstream fileContents;
|
||||||
std::ifstream file("save_file_path"_S+std::format("save.{:04}",saveFileID));
|
std::ifstream file("save_file_path"_S+std::format("save.{:04}",saveFileID)+"_online");
|
||||||
while(file.good()){
|
while(file.good()){
|
||||||
int val=file.get();
|
int val=file.get();
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
@ -133,7 +134,7 @@ const void SaveFile::SaveGame(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::string contents=fileContents.str();
|
std::string contents=fileContents.str();
|
||||||
emscripten_idb_async_store("/assets",("save_file_path"_S+std::format("save.{:04}",saveFileID)).c_str(),contents.data(),contents.length(),0,[](void*arg){
|
emscripten_idb_async_store("/assets",("save_file_path"_S+std::format("save.{:04}",saveFileID)+"_online").c_str(),contents.data(),contents.length(),0,[](void*arg){
|
||||||
std::cout<<"Successfully saved save file "<<saveFileID<<"!"<<std::endl;
|
std::cout<<"Successfully saved save file "<<saveFileID<<"!"<<std::endl;
|
||||||
},[](void*arg){
|
},[](void*arg){
|
||||||
std::cout<<"Failed to save save file "<<saveFileID<<"!"<<std::endl;
|
std::cout<<"Failed to save save file "<<saveFileID<<"!"<<std::endl;
|
||||||
@ -153,6 +154,7 @@ const void SaveFile::SaveGame(){
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
Server_SaveMetadataFile(RetryResponse);
|
Server_SaveMetadataFile(RetryResponse);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,6 +266,30 @@ const void SaveFile::UpdateSaveGameData(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
auto LoadOnlineMetadataFile=[](){
|
||||||
|
auto gameFilesList=Component<ScrollableWindowComponent>(LOAD_GAME,"Game Files List");
|
||||||
|
gameFilesList->RemoveAllComponents();
|
||||||
|
if(SaveFile::IsOnline()){
|
||||||
|
const size_t saveFileCount=GetSaveFileCount();
|
||||||
|
utils::datafile metadata;
|
||||||
|
if(!std::filesystem::exists("save_file_path"_S+"metadata.dat")){
|
||||||
|
utils::datafile::Write(metadata,"save_file_path"_S+"metadata.dat");
|
||||||
|
}
|
||||||
|
utils::datafile::Read(metadata,"save_file_path"_S+"metadata.dat");
|
||||||
|
float offsetY=0;
|
||||||
|
for(size_t i=0;i<saveFileCount;i++){
|
||||||
|
if(metadata.HasProperty(std::format("save{}",i))){
|
||||||
|
gameFilesList->ADD(std::format("Load File Button - Save {}",i),LoadFileButton)(geom2d::rect<float>{{0,offsetY},{gameFilesList->GetSize().x-13,48}},metadata[std::format("save{}",i)],i,[](MenuFuncData data){
|
||||||
|
std::weak_ptr<LoadFileButton>comp=DYNAMIC_POINTER_CAST<LoadFileButton>(data.component.lock());
|
||||||
|
saveFileID=comp.lock()->getSaveFileID();
|
||||||
|
SaveFile::LoadGame();
|
||||||
|
return true;
|
||||||
|
},ButtonAttr::NONE)END;
|
||||||
|
offsetY+=49;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
LoadMetadataFile();
|
LoadMetadataFile();
|
||||||
|
|
||||||
@ -337,7 +363,7 @@ const void SaveFile::Server_GetFile(std::function<void(std::string_view)>respCal
|
|||||||
}
|
}
|
||||||
const void SaveFile::Server_SaveFile(std::function<void(std::string_view)>respCallbackFunc){
|
const void SaveFile::Server_SaveFile(std::function<void(std::string_view)>respCallbackFunc){
|
||||||
std::stringstream fileContents;
|
std::stringstream fileContents;
|
||||||
std::ifstream file("save_file_path"_S+std::format("save.{:04}",saveFileID));
|
std::ifstream file("save_file_path"_S+std::format("save.{:04}",saveFileID)+"_online");
|
||||||
while(file.good()){
|
while(file.good()){
|
||||||
int val=file.get();
|
int val=file.get();
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
@ -349,21 +375,19 @@ const void SaveFile::Server_SaveFile(std::function<void(std::string_view)>respCa
|
|||||||
}
|
}
|
||||||
const void SaveFile::Server_SaveMetadataFile(std::function<void(std::string_view)>respCallbackFunc){
|
const void SaveFile::Server_SaveMetadataFile(std::function<void(std::string_view)>respCallbackFunc){
|
||||||
std::stringstream fileContents;
|
std::stringstream fileContents;
|
||||||
std::ifstream file("save_file_path"_S+"metadata.dat");
|
std::ifstream file("save_file_path"_S+"metadata.dat"+"_online");
|
||||||
while(file.good()){
|
while(file.good()){
|
||||||
int val=file.get();
|
int val=file.get();
|
||||||
if(val!=-1){
|
if(val!=-1){
|
||||||
fileContents<<char(val);
|
fileContents<<char(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
std::string contents=fileContents.str();
|
std::string contents=fileContents.str();
|
||||||
emscripten_idb_async_store("/assets",("save_file_path"_S+"metadata.dat").c_str(),contents.data(),contents.length(),0,[](void*arg){
|
emscripten_idb_async_store("/assets",("save_file_path"_S+"metadata.dat"+"_online").c_str(),contents.data(),contents.length(),0,[](void*arg){
|
||||||
std::cout<<"Saved metadata successfully!"<<std::endl;
|
std::cout<<"Saved metadata successfully!"<<std::endl;
|
||||||
},[](void*arg){
|
},[](void*arg){
|
||||||
std::cout<<"Failed to save metadata!"<<std::endl;
|
std::cout<<"Failed to save metadata!"<<std::endl;
|
||||||
});
|
});
|
||||||
#endif
|
|
||||||
game->SendRequest("save_server"_S,CreateServerRequest(SaveFileOperation::SAVE_METADATA_FILE,fileContents.str()));
|
game->SendRequest("save_server"_S,CreateServerRequest(SaveFileOperation::SAVE_METADATA_FILE,fileContents.str()));
|
||||||
game->responseCallback=respCallbackFunc;
|
game->responseCallback=respCallbackFunc;
|
||||||
}
|
}
|
||||||
@ -375,6 +399,10 @@ const void SaveFile::SetUserID(std::string_view userID){
|
|||||||
SaveFile::username=userID;
|
SaveFile::username=userID;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SaveFile::IsOnline(){
|
const bool SaveFile::IsOnline(){
|
||||||
return onlineMode;
|
return onlineMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveFile::SetOnlineMode(bool online){
|
||||||
|
onlineMode=online;
|
||||||
|
}
|
@ -57,7 +57,8 @@ public:
|
|||||||
static const std::string_view GetSaveFileName();
|
static const std::string_view GetSaveFileName();
|
||||||
static const void SetSaveFileName(std::string_view saveFileName);
|
static const void SetSaveFileName(std::string_view saveFileName);
|
||||||
static const size_t GetSaveFileCount();
|
static const size_t GetSaveFileCount();
|
||||||
static bool IsOnline();
|
static const bool IsOnline();
|
||||||
|
static void SetOnlineMode(bool online);
|
||||||
static const std::string_view GetUserID();
|
static const std::string_view GetUserID();
|
||||||
static const void SetUserID(std::string_view userID);
|
static const void SetUserID(std::string_view userID);
|
||||||
static const void SaveGame();
|
static const void SaveGame();
|
||||||
|
@ -334,6 +334,15 @@ MonsterStrategy
|
|||||||
|
|
||||||
# Maximum amount of time the boss takes to run towards the center before giving up and continuing through Phase 2.
|
# Maximum amount of time the boss takes to run towards the center before giving up and continuing through Phase 2.
|
||||||
Run to Center Time = 10.0s
|
Run to Center Time = 10.0s
|
||||||
|
|
||||||
|
# Number of stomps to perform before doing a run towards the player.
|
||||||
|
Stomp Count = 3
|
||||||
|
|
||||||
|
# Amount of time to run towards the player.
|
||||||
|
Run Time = 2.0s
|
||||||
|
|
||||||
|
# Provide a speed boost amount during the run.
|
||||||
|
Run Speed Boost = 0%
|
||||||
}
|
}
|
||||||
Phase 2
|
Phase 2
|
||||||
{
|
{
|
||||||
@ -419,6 +428,15 @@ MonsterStrategy
|
|||||||
|
|
||||||
# Amount of knockback to cause to the player when hit by the charging attack.
|
# Amount of knockback to cause to the player when hit by the charging attack.
|
||||||
Charge Attack Knockback Strength = 3.5
|
Charge Attack Knockback Strength = 3.5
|
||||||
|
|
||||||
|
# Number of stomps to perform before doing a run towards the player.
|
||||||
|
Stomp Count = 3
|
||||||
|
|
||||||
|
# Amount of time to run towards the player.
|
||||||
|
Run Time = 2.0s
|
||||||
|
|
||||||
|
# Provide a speed boost amount during the run.
|
||||||
|
Run Speed Boost = 0%
|
||||||
}
|
}
|
||||||
Phase 4
|
Phase 4
|
||||||
{
|
{
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 7.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 5.0 KiB |
Loading…
x
Reference in New Issue
Block a user