Walk animation controller now applied to the overworld map stage.
This commit is contained in:
parent
c065e9f6fb
commit
42f8e25cdf
@ -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(){
|
||||
|
@ -51,7 +51,6 @@ private:
|
||||
Animate2D::Animation<std::string>animation;
|
||||
Animate2D::AnimationState internal_animState;
|
||||
Key lastReleasedMovementKey;
|
||||
void Update(float fElapsedTime);
|
||||
void AddAnimation(std::string state);
|
||||
std::vector<Buff>buffList;
|
||||
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::vector<Buff>GetBuffs(BuffType buff);
|
||||
|
@ -18,5 +18,6 @@ namespace State{
|
||||
ANIMATION_LOCK,
|
||||
JUMP,
|
||||
RECOVERY,
|
||||
FORCE_WALK,
|
||||
};
|
||||
}
|
@ -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());
|
||||
|
@ -11,14 +11,17 @@ 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.
|
||||
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){
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user