diff --git a/Crawler/Player.cpp b/Crawler/Player.cpp index 39167035..8e9cd668 100644 --- a/Crawler/Player.cpp +++ b/Crawler/Player.cpp @@ -9,6 +9,7 @@ #include "utils.h" #include "Key.h" #include "Menu.h" +#include "GameState.h" INCLUDE_MONSTER_DATA INCLUDE_MONSTER_LIST @@ -510,7 +511,7 @@ bool Player::CanAct(){ } bool Player::CanAct(Ability&ability){ - return (ability.canCancelCast||state!=State::CASTING)&&state!=State::ANIMATION_LOCK; + return (ability.canCancelCast||state!=State::CASTING)&&state!=State::ANIMATION_LOCK&&GameState::STATE==GameState::states[States::GAME_RUN]; } bool Player::HasIframes(){ diff --git a/Crawler/Player.h b/Crawler/Player.h index 0db0eaa5..52689ba6 100644 --- a/Crawler/Player.h +++ b/Crawler/Player.h @@ -51,7 +51,6 @@ private: Animate2D::Animationanimation; Animate2D::AnimationState internal_animState; Key lastReleasedMovementKey; - void Update(float fElapsedTime); void AddAnimation(std::string state); std::vectorbuffList; CastInfo castInfo={"",0}; @@ -65,7 +64,6 @@ protected: const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; float ARROW_ATTACK_COOLDOWN="Ranger.Auto Attack.Cooldown"_F; void SetSwordSwingTimer(float val); - void SetState(State::State newState); void SetFacingDirection(Key direction); void SetLastReleasedMovementKey(Key k); void Spin(float duration,float spinSpd); @@ -122,6 +120,7 @@ public: Key GetFacingDirection(); vf2d GetVelocity(); bool HasIframes(); + void Update(float fElapsedTime); void UpdateWalkingAnimation(Key direction); void UpdateIdleAnimation(Key direction); //The range is the search range in tiles. @@ -140,6 +139,7 @@ public: void SetZ(float z); //Returns true if the move was valid and successful. bool SetPos(vf2d pos); + void SetState(State::State newState); void AddBuff(BuffType type,float duration,float intensity); std::vectorGetBuffs(BuffType buff); diff --git a/Crawler/State.h b/Crawler/State.h index 2a41018d..0dda5449 100644 --- a/Crawler/State.h +++ b/Crawler/State.h @@ -18,5 +18,6 @@ namespace State{ ANIMATION_LOCK, JUMP, RECOVERY, + FORCE_WALK, }; } \ No newline at end of file diff --git a/Crawler/State_GameRun.cpp b/Crawler/State_GameRun.cpp index ffe55f46..5b6a715f 100644 --- a/Crawler/State_GameRun.cpp +++ b/Crawler/State_GameRun.cpp @@ -4,9 +4,11 @@ #include "Menu.h" INCLUDE_MONSTER_LIST +INCLUDE_game void State_GameRun::OnStateChange(GameState*prevState){ Menu::CloseAllMenus(); + game->GetPlayer()->SetState(State::NORMAL); }; void State_GameRun::OnUserUpdate(Crawler*game){ game->bossDisplayTimer=std::max(0.f,game->bossDisplayTimer-game->GetElapsedTime()); diff --git a/Crawler/State_OverworldMap.cpp b/Crawler/State_OverworldMap.cpp index faee8551..22a4fcfc 100644 --- a/Crawler/State_OverworldMap.cpp +++ b/Crawler/State_OverworldMap.cpp @@ -11,14 +11,17 @@ std::vectorState_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. - game->GetPlayer()->SetPos(currentConnectionPoint->rect.pos); } 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){ diff --git a/Crawler/Version.h b/Crawler/Version.h index bee5e765..fc6c74b2 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 2450 +#define VERSION_BUILD 2457 #define stringify(a) stringify_(a) #define stringify_(a) #a