Added analog controller precision movement for controllers. Fixed bugs with animation system involving movement velocities not being consistent nor updating correctly for up/down directions. New Steam Controller Configurations. Release Build 8577.

mac-build
sigonasr2 10 months ago
parent 047819d548
commit b8790c16b6
  1. 109
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 8
      Adventures in Lestoria/Animation.cpp
  3. 8
      Adventures in Lestoria/Player.cpp
  4. 7
      Adventures in Lestoria/Player.h
  5. 2
      Adventures in Lestoria/SteamStatsReceivedHandler.cpp
  6. 3
      Adventures in Lestoria/TODO.txt
  7. 2
      Adventures in Lestoria/Version.h
  8. 3
      Adventures in Lestoria/assets/config/Player.txt
  9. 43
      Adventures in Lestoria/controller_config/controller_generic.vdf
  10. 43
      Adventures in Lestoria/controller_config/controller_switch_pro.vdf
  11. 41
      Adventures in Lestoria/controller_config/controller_xboxone.vdf
  12. 29
      Adventures in Lestoria/controller_config/game_actions_2895980.vdf
  13. 16
      Adventures in Lestoria/olcUTIL_Animate2D.h
  14. BIN
      x64/Release/Adventures in Lestoria.exe

@ -453,6 +453,7 @@ void AiL::HandleUserInput(float fElapsedTime){
if(KEY_MENU.Released()){
Menu::OpenMenu(MenuType::PAUSE);
}
float animationSpd=0.f;
if(player->GetVelocity().mag()<"Player.Move Allowed Velocity Lower Limit"_F&&player->CanMove()){
auto GetPlayerStaircaseDirection=[&](){
for(LayerTag&layer:MAP_DATA[GetCurrentLevel()].LayerData){
@ -469,20 +470,29 @@ void AiL::HandleUserInput(float fElapsedTime){
std::string staircaseDirection=GetPlayerStaircaseDirection();
vf2d newAimingAngle{};
if(RightHeld()){
player->SetX(player->GetX()+fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
player->movementVelocity.x="Player.MoveSpd"_F;
float moveAmt="Player.MoveSpd"_F;
if(Input::UsingGamepad()&&KEY_SCROLLHORZ_L.Analog()>=0.2f){
float controllerAmt=abs(KEY_SCROLLHORZ_L.Analog());
if(controllerAmt>=0.8f)controllerAmt=1.f; //Edge zone.
if(controllerAmt>animationSpd){
animationSpd=controllerAmt;
}
moveAmt*=controllerAmt;
}else
if(!Input::UsingGamepad()){
animationSpd=1.f;
}
player->SetX(player->GetX()+fElapsedTime*moveAmt*player->GetMoveSpdMult());
player->movementVelocity.x=moveAmt*fElapsedTime*player->GetMoveSpdMult();
if(staircaseDirection=="RIGHT"){
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult();
} else
if(staircaseDirection=="LEFT"){
player->SetY(player->GetY()+"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
player->movementVelocity.y="Player.StaircaseClimbSpd"_F;
player->movementVelocity.y="Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult();
}
player->SetFacingDirection(RIGHT);
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
player->UpdateWalkingAnimation(RIGHT);
}
newAimingAngle+=vf2d{1,0};
@ -490,21 +500,27 @@ void AiL::HandleUserInput(float fElapsedTime){
heldDownMovementKey=true;
}
if(LeftHeld()){
player->SetX(player->GetX()-fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
player->movementVelocity.x=-"Player.MoveSpd"_F;
float moveAmt="Player.MoveSpd"_F;
if(Input::UsingGamepad()&&KEY_SCROLLHORZ_L.Analog()<=-0.2f){
float controllerAmt=abs(KEY_SCROLLHORZ_L.Analog());
if(controllerAmt>=0.8f)controllerAmt=1.f; //Edge zone.
if(controllerAmt>animationSpd){
animationSpd=controllerAmt;
}
moveAmt*=abs(KEY_SCROLLHORZ_L.Analog());
}else
if(!Input::UsingGamepad()){
animationSpd=1.f;
}
player->SetX(player->GetX()-fElapsedTime*moveAmt*player->GetMoveSpdMult());
player->movementVelocity.x=-moveAmt*fElapsedTime*player->GetMoveSpdMult();
if(staircaseDirection=="RIGHT"){
player->SetY(player->GetY()+"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
player->movementVelocity.y="Player.StaircaseClimbSpd"_F;
player->movementVelocity.y="Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult();
} else
if(staircaseDirection=="LEFT"){
player->SetY(player->GetY()-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult());
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F;
}
if(setIdleAnimation){
player->SetFacingDirection(LEFT);
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
player->UpdateWalkingAnimation(LEFT);
}
player->movementVelocity.y=-"Player.StaircaseClimbSpd"_F*fElapsedTime*player->GetMoveSpdMult();
}
newAimingAngle-=vf2d{1,0};
@ -513,14 +529,20 @@ void AiL::HandleUserInput(float fElapsedTime){
heldDownMovementKey=true;
}
if(UpHeld()){
player->SetY(player->GetY()-fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
player->movementVelocity.y=-"Player.MoveSpd"_F*fElapsedTime;
if(setIdleAnimation){
player->SetFacingDirection(UP);
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
player->UpdateWalkingAnimation(UP);
}
float moveAmt="Player.MoveSpd"_F;
if(Input::UsingGamepad()&&KEY_SCROLLVERT_L.Analog()<=-0.2f){
float controllerAmt=abs(KEY_SCROLLVERT_L.Analog());
if(controllerAmt>=0.8f)controllerAmt=1.f; //Edge zone.
if(controllerAmt>animationSpd){
animationSpd=controllerAmt;
}
moveAmt*=abs(KEY_SCROLLVERT_L.Analog());
}else
if(!Input::UsingGamepad()){
animationSpd=1.f;
}
player->SetY(player->GetY()-fElapsedTime*moveAmt*player->GetMoveSpdMult());
player->movementVelocity.y=-moveAmt*fElapsedTime*player->GetMoveSpdMult();
newAimingAngle-=vf2d{0,1};
@ -528,14 +550,20 @@ void AiL::HandleUserInput(float fElapsedTime){
heldDownMovementKey=true;
}
if(DownHeld()){
player->SetY(player->GetY()+fElapsedTime*"Player.MoveSpd"_F*player->GetMoveSpdMult());
player->movementVelocity.y="Player.MoveSpd"_F*fElapsedTime;
if(setIdleAnimation){
player->SetFacingDirection(DOWN);
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
player->UpdateWalkingAnimation(DOWN);
}
float moveAmt="Player.MoveSpd"_F;
if(Input::UsingGamepad()&&KEY_SCROLLVERT_L.Analog()>=0.2f){
float controllerAmt=abs(KEY_SCROLLVERT_L.Analog());
if(controllerAmt>=0.8f)controllerAmt=1.f; //Edge zone.
if(controllerAmt>animationSpd){
animationSpd=controllerAmt;
}
moveAmt*=abs(KEY_SCROLLVERT_L.Analog());
}else
if(!Input::UsingGamepad()){
animationSpd=1.f;
}
player->SetY(player->GetY()+fElapsedTime*moveAmt*player->GetMoveSpdMult());
player->movementVelocity.y=moveAmt*fElapsedTime*player->GetMoveSpdMult();
newAimingAngle+=vf2d{0,1};
@ -546,6 +574,23 @@ void AiL::HandleUserInput(float fElapsedTime){
player->aimingAngle=newAimingAngle.norm().polar();
}
}
if(heldDownMovementKey){
if(abs(player->movementVelocity.x)>abs(player->movementVelocity.y)){ //Greater Horizontal movement.
if(player->movementVelocity.x!=0.f){
player->SetFacingDirection(player->movementVelocity.x>0?RIGHT:LEFT);
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
player->UpdateWalkingAnimation(player->GetFacingDirection(),animationSpd);
}
}
}else{ //Greater Vertical movement.
if(player->movementVelocity.y!=0.f){
player->SetFacingDirection(player->movementVelocity.y>0?DOWN:UP);
if(player->GetState()==State::NORMAL||player->GetState()==State::PREP_CAST){
player->UpdateWalkingAnimation(player->GetFacingDirection(),animationSpd);
}
}
}
}
if(UpReleased()){
player->SetLastReleasedMovementKey(UP);
player->movementVelocity.y=0;
@ -612,7 +657,7 @@ void AiL::HandleUserInput(float fElapsedTime){
}
if(heldDownMovementKey){
player->footstepTimer+=GetElapsedTime();
player->footstepTimer+=GetElapsedTime()*animationSpd;
if(player->footstepTimer>"Player.Footstep Timer"_F){
player->footstepTimer-="Player.Footstep Timer"_F;

@ -61,25 +61,25 @@ void sig::Animation::InitializeAnimations(){
};
auto SetupClassWalkIdleAnimations=[&](Renderable&sheet,std::string className){
Animate2D::FrameSequence pl_walk_s{0.2f};
Animate2D::FrameSequence pl_walk_s{"Player.WalkingFrameSpd"_F};
pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{1,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{2,0}*24,{24,24}}});
ANIMATION_DATA[className+"_WALK_S"]=pl_walk_s;
Animate2D::FrameSequence pl_walk_e{0.2f};
Animate2D::FrameSequence pl_walk_e{"Player.WalkingFrameSpd"_F};
pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{1,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{2,3}*24,{24,24}}});
ANIMATION_DATA[className+"_WALK_E"]=pl_walk_e;
Animate2D::FrameSequence pl_walk_w{0.2f};
Animate2D::FrameSequence pl_walk_w{"Player.WalkingFrameSpd"_F};
pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{1,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{2,2}*24,{24,24}}});
ANIMATION_DATA[className+"_WALK_W"]=pl_walk_w;
Animate2D::FrameSequence pl_walk_n{0.2f};
Animate2D::FrameSequence pl_walk_n{"Player.WalkingFrameSpd"_F};
pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{1,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});

@ -780,9 +780,9 @@ void Player::AddAnimation(std::string state){
animation.AddState(state,ANIMATION_DATA.at(state));
}
void Player::UpdateAnimation(std::string animState,int specificClass){
void Player::UpdateAnimation(std::string animState,int specificClass, const float frameMult){
if(specificClass==ANY||specificClass&GetClass()){
animation.ChangeState(internal_animState,animState);
animation.ChangeState(internal_animState,animState,frameMult);
}
}
@ -871,7 +871,7 @@ void Player::Spin(float duration,float spinSpd){
spin_angle=0;
}
void Player::UpdateWalkingAnimation(Key direction){
void Player::UpdateWalkingAnimation(Key direction, const float frameMult){
std::string anim;
switch(direction){
case UP:anim=GetWalkNAnimation();break;
@ -879,7 +879,7 @@ void Player::UpdateWalkingAnimation(Key direction){
case DOWN:anim=GetWalkSAnimation();break;
case LEFT:anim=GetWalkWAnimation();break;
}
UpdateAnimation(anim);
UpdateAnimation(anim,0,frameMult);
}
void Player::UpdateIdleAnimation(Key direction){

@ -133,7 +133,7 @@ public:
vf2d GetVelocity();
bool HasIframes();
void Update(float fElapsedTime);
void UpdateWalkingAnimation(Key direction);
void UpdateWalkingAnimation(Key direction, const float frameMult=1.f);
void UpdateIdleAnimation(Key direction);
//The range is the search range in tiles.
bool CanPathfindTo(vf2d pos,vf2d targetPos,float range=8);
@ -176,9 +176,8 @@ public:
bool Hurt(int damage,bool onUpperLevel,float z);
//Return false if healing was not possible.
bool Heal(int damage,bool suppressDamageNumber=false);
//specificClass is a bitwise-combination of classes from the Class enum. It makes sure certain animations only play if you are a certain class.
//Set force to true to force the animation to restart evne if the animation were already playing.
void UpdateAnimation(std::string animState,int specificClass=ANY);
//specificClass is a bitwise-combination of classes from the Class enum. It makes sure certain animations only play if you are a certain class.=
void UpdateAnimation(std::string animState,int specificClass=ANY,const float frameMult=1.f);
Animate2D::Frame GetFrame();
Key GetLastReleasedMovementKey();
float GetSwordSwingTimer();

@ -48,7 +48,7 @@ INCLUDE_DATA
void SteamStatsReceivedHandler::SteamStatsReceived( UserStatsReceived_t* pCallback ){
if(pCallback->m_eResult==k_EResultOK){
SteamUserStats()->GetStat("Achievement.Kill Unlocks.Total Kill API Name"_S.c_str(),&Unlock::monsterKillCount);
LOG(std::format("Retried monster kill count: {}",Unlock::monsterKillCount));
LOG(std::format("Retrived monster kill count: {}",Unlock::monsterKillCount));
}
}
#endif

@ -35,6 +35,9 @@ File Hash on Save/Load.
Include a Reset Achievements button in Settings
Move based on analog stick amount instead of full speed by default
Still aiming at a target down below?
============================================
Consider a "killed by player" / "marked by player" flag for monsters to determine if a player gets credit for a monster kill (for achievements)
Make another actions config file for the main build (The app # is different)

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 0
#define VERSION_PATCH 0
#define VERSION_BUILD 8551
#define VERSION_BUILD 8577
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -20,6 +20,9 @@ Player
# Amount of spd to increase/decrease vertically as you climb staircases
StaircaseClimbSpd = 45
# Walking Default Animation Delay per Frame
WalkingFrameSpd = 0.2s
# How much speed the player loses while no momentum is being added.
Friction = 400

@ -1,18 +1,18 @@
"controller_mappings"
{
"version" "3"
"revision" "82"
"title" "#Title_Config"
"description" "#Description_Config"
"revision" "87"
"title" "Generic Gamepad"
"description" "Default Generic Gamepad controls"
"creator" "76561198025675819"
"progenitor" ""
"url" "usercloud://2895980/generic gamepad_3"
"export_type" "personal_cloud"
"url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_generic.vdf"
"export_type" "personal_local"
"controller_type" "controller_generic"
"controller_caps" "1573375"
"major_revision" "0"
"minor_revision" "0"
"Timestamp" "1711341077"
"Timestamp" "1711752971"
"actions"
{
"InGameControls"
@ -21,6 +21,11 @@
"legacy_set" "0"
"StickPadGyro"
{
"Move"
{
"title" "#Move"
"input_mode" "joystick_move"
}
"Scroll"
{
"title" "#Scroll"
@ -66,8 +71,8 @@
{
"english"
{
"Title_Config" "Generic Gamepad"
"Description_Config" "Generic gamepad configuration."
"Title_Config" "Adventures in Lestoria Configuration"
"Description_Config" "The default control set for Adventures in Lestoria."
"Set_Ingame" "Gameplay Controls"
"BasicAttack" "Basic Attack"
"Defensive" "Use Defensive"
@ -84,6 +89,7 @@
"Function1" "Menu Function 1"
"Function2" "Menu Function 2"
"Menu" "Menu/Pause"
"Move" "Move"
"Up" "Up"
"Down" "Down"
"Left" "Left"
@ -614,6 +620,24 @@
}
}
"group"
{
"id" "24"
"mode" "joystick_move"
"name" ""
"description" ""
"inputs"
{
}
"settings"
{
"virtual_mode" "1"
}
"gameactions"
{
"InGameControls" "Move"
}
}
"group"
{
"id" "0"
"mode" "switches"
@ -761,7 +785,8 @@
"2" "left_trigger active"
"3" "right_trigger active"
"15" "joystick inactive"
"23" "joystick active"
"23" "joystick inactive"
"24" "joystick active"
"16" "right_joystick inactive"
"22" "right_joystick active"
"14" "dpad inactive"

@ -1,18 +1,18 @@
"controller_mappings"
{
"version" "3"
"revision" "83"
"title" "#Title_Config"
"description" "#Description_Config"
"revision" "85"
"title" "Switch Pro"
"description" "Default Switch Pro configuration."
"creator" "76561198025675819"
"progenitor" ""
"url" "usercloud://2895980/switch pro configuration_0"
"export_type" "personal_cloud"
"url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_switch_pro.vdf"
"export_type" "personal_local"
"controller_type" "controller_switch_pro"
"controller_caps" "613772287"
"major_revision" "0"
"minor_revision" "0"
"Timestamp" "1711340749"
"Timestamp" "1711752483"
"actions"
{
"InGameControls"
@ -21,6 +21,11 @@
"legacy_set" "0"
"StickPadGyro"
{
"Move"
{
"title" "#Move"
"input_mode" "joystick_move"
}
"Scroll"
{
"title" "#Scroll"
@ -66,8 +71,8 @@
{
"english"
{
"Title_Config" "Switch Pro"
"Description_Config" "Nintendo Switch Pro controller configuration."
"Title_Config" "Adventures in Lestoria Configuration"
"Description_Config" "The default control set for Adventures in Lestoria."
"Set_Ingame" "Gameplay Controls"
"BasicAttack" "Basic Attack"
"Defensive" "Use Defensive"
@ -84,6 +89,7 @@
"Function1" "Menu Function 1"
"Function2" "Menu Function 2"
"Menu" "Menu/Pause"
"Move" "Move"
"Up" "Up"
"Down" "Down"
"Left" "Left"
@ -614,6 +620,24 @@
}
}
"group"
{
"id" "25"
"mode" "joystick_move"
"name" ""
"description" ""
"inputs"
{
}
"settings"
{
"virtual_mode" "1"
}
"gameactions"
{
"InGameControls" "Move"
}
}
"group"
{
"id" "0"
"mode" "switches"
@ -761,7 +785,8 @@
"2" "left_trigger active"
"3" "right_trigger active"
"15" "joystick inactive"
"23" "joystick active"
"23" "joystick inactive"
"25" "joystick active"
"16" "right_joystick inactive"
"22" "right_joystick active"
"14" "dpad inactive"

@ -1,18 +1,18 @@
"controller_mappings"
{
"version" "3"
"revision" "76"
"title" "#Title_Config"
"description" "#Description_Config"
"revision" "78"
"title" "Xbox/Playstation"
"description" "Default Xbox/Playstation controls"
"creator" "76561198025675819"
"progenitor" ""
"url" "autosave://C:\\Program Files (x86)\\Steam\\steamapps\\common\\Steam Controller Configs\\65410091\\config\\2895980\\controller_xbox360.vdf"
"export_type" "personal_cloud"
"export_type" "personal_local"
"controller_type" "controller_xbox360"
"controller_caps" "1590271"
"major_revision" "0"
"minor_revision" "0"
"Timestamp" "1711340807"
"Timestamp" "1711752757"
"actions"
{
"InGameControls"
@ -21,6 +21,11 @@
"legacy_set" "0"
"StickPadGyro"
{
"Move"
{
"title" "#Move"
"input_mode" "joystick_move"
}
"Scroll"
{
"title" "#Scroll"
@ -66,8 +71,8 @@
{
"english"
{
"Title_Config" "Xbox/Playstation"
"Description_Config" "Xbox/Playstation controller configuration."
"Title_Config" "Adventures in Lestoria Configuration"
"Description_Config" "The default control set for Adventures in Lestoria."
"Set_Ingame" "Gameplay Controls"
"BasicAttack" "Basic Attack"
"Defensive" "Use Defensive"
@ -84,6 +89,7 @@
"Function1" "Menu Function 1"
"Function2" "Menu Function 2"
"Menu" "Menu/Pause"
"Move" "Move"
"Up" "Up"
"Down" "Down"
"Left" "Left"
@ -614,6 +620,24 @@
}
}
"group"
{
"id" "24"
"mode" "joystick_move"
"name" ""
"description" ""
"inputs"
{
}
"settings"
{
"virtual_mode" "1"
}
"gameactions"
{
"InGameControls" "Move"
}
}
"group"
{
"id" "0"
"mode" "switches"
@ -761,7 +785,8 @@
"2" "left_trigger active"
"3" "right_trigger active"
"15" "joystick inactive"
"23" "joystick active"
"23" "joystick inactive"
"24" "joystick active"
"16" "right_joystick inactive"
"22" "right_joystick active"
"14" "dpad inactive"

@ -7,6 +7,11 @@
"title" "#Set_Ingame"
"StickPadGyro"
{
"Move"
{
"title" "#Move"
"input_mode" "joystick_move"
}
"Scroll"
{
"title" "#Scroll"
@ -64,6 +69,7 @@
"Function1" "Menu Function 1"
"Function2" "Menu Function 2"
"Menu" "Menu/Pause"
"Move" "Move"
"Up" "Up"
"Down" "Down"
"Left" "Left"
@ -79,7 +85,28 @@
{
"0"
{
"path" "controller_xbox360.vdf"
"path" "controller_xboxone.vdf"
}
}
"controller_xboxone"
{
"0"
{
"path" "controller_xboxone.vdf"
}
}
"controller_ps5"
{
"0"
{
"path" "controller_xboxone.vdf"
}
}
"controller_ps4"
{
"0"
{
"path" "controller_xboxone.vdf"
}
}
"controller_generic"

@ -104,6 +104,10 @@ namespace olc::utils::Animate2D
class FrameSequence
{
public:
Style m_nStyle;
std::vector<Frame> m_vFrames;
float m_fFrameDuration = 0.1f;
float m_fFrameRate = 10.0f;
// Constructs a sequence of frames with a duration and a traversal style
inline FrameSequence(const float fFrameDuration = 0.1f, const Style nStyle = Style::Repeat)
{
@ -125,10 +129,6 @@ namespace olc::utils::Animate2D
}
private:
Style m_nStyle;
std::vector<Frame> m_vFrames;
float m_fFrameDuration = 0.1f;
float m_fFrameRate = 10.0f;
inline const size_t ConvertTimeToFrame(const float fTime) const
{
@ -170,7 +170,13 @@ namespace olc::utils::Animate2D
{
public:
Animation() = default;
float mult = 1.f;
inline bool ChangeState(AnimationState& state, const StatesEnum& sStateName, const float frameMult)
{
mult=frameMult;
return ChangeState(state,sStateName);
}
// Change an animation state token to a new state
inline bool ChangeState(AnimationState& state, const StatesEnum& sStateName) const
{
@ -188,7 +194,7 @@ namespace olc::utils::Animate2D
// Update an animation state token
inline void UpdateState(AnimationState& state, const float fElapsedTime) const
{
state.fTime = std::fmod(state.fTime+fElapsedTime,1000);
state.fTime = std::fmod(state.fTime+fElapsedTime*mult,1000);
}
public:

Loading…
Cancel
Save