diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index c92529b7..cf94dce3 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -952,6 +952,10 @@ + + + + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 7e6526ee..c9366ff7 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -1118,6 +1118,9 @@ Source Files\Bullet Types + + Source Files\Effects + diff --git a/Adventures in Lestoria/Effect.h b/Adventures in Lestoria/Effect.h index 5a21e24c..8220d5ed 100644 --- a/Adventures in Lestoria/Effect.h +++ b/Adventures in Lestoria/Effect.h @@ -115,4 +115,13 @@ struct SpellCircle:Effect{ Effect spellInsignia{vf2d{},0.f,"spell_insignia.png",false,{}}; virtual bool Update(float fElapsedTime)override final; virtual void Draw()const override final; +}; + +struct RockLaunch:Effect{ + //The lifetime is for how long the effect lasts after it's launched. You don't have to calculate extra lifetime to compensate for the delayTime, it is done for you. + RockLaunch(vf2d pos,float lifetime,std::string imgFile,float delayTime,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending=false); + virtual bool Update(float fElapsedTime)override final; +private: + float delayTime; + vf2d futureSpd; }; \ No newline at end of file diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h index 73402553..a366b8e1 100644 --- a/Adventures in Lestoria/MonsterAttribute.h +++ b/Adventures in Lestoria/MonsterAttribute.h @@ -139,4 +139,8 @@ enum class Attribute{ RESPAWN_LOOPING_SOUND_ID, //NOTE: Store looping sound IDs temporarily with this value. The game automatically cleans this up in Monster::OnDestroy() if you don't, since a monster that dies should not have their looping sound still playing. SAFE_AREA_WAIT_TIMER, PREVIOUS_MONSTER_COUNT, + CHASE_TIMER, + STONE_RAIN_COUNT, + STONE_TOSS_COUNT, + STONE_TOSS_TIMER, }; \ No newline at end of file diff --git a/Adventures in Lestoria/MonsterData.cpp b/Adventures in Lestoria/MonsterData.cpp index 8569aa4f..9ad90841 100644 --- a/Adventures in Lestoria/MonsterData.cpp +++ b/Adventures in Lestoria/MonsterData.cpp @@ -117,6 +117,9 @@ void MonsterData::InitializeMonsterData(){ }else if(data.GetString(2)=="Reverse"){ style=Animate2D::Style::Reverse; + }else + if(data.GetString(2)=="ReverseOneShot"){ + style=Animate2D::Style::ReverseOneShot; }else{ ERR(std::format("WARNING! Invalid Animation Style specified: {}",int(style))); } @@ -289,6 +292,9 @@ void MonsterData::InitializeNPCData(){ }else if(data.GetString(2)=="Reverse"){ style=Animate2D::Style::Reverse; + }else + if(data.GetString(2)=="ReverseOneShot"){ + style=Animate2D::Style::ReverseOneShot; }else{ ERR(std::format("WARNING! Invalid Animation Style specified: {}",int(style))); } diff --git a/Adventures in Lestoria/RockLaunch.cpp b/Adventures in Lestoria/RockLaunch.cpp new file mode 100644 index 00000000..91a832ef --- /dev/null +++ b/Adventures in Lestoria/RockLaunch.cpp @@ -0,0 +1,47 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2024 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion + +#include "Effect.h" + +RockLaunch::RockLaunch(vf2d pos,float lifetime,std::string imgFile,float delayTime,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending) +:Effect(pos,lifetime+delayTime,imgFile,false,size,fadeout,{},col,rotation,rotationSpd,additiveBlending),delayTime(delayTime),futureSpd(spd){} +bool RockLaunch::Update(float fElapsedTime){ + delayTime-=fElapsedTime; + if(delayTime<=0.f)spd=futureSpd; + return Effect::Update(fElapsedTime); +}; \ No newline at end of file diff --git a/Adventures in Lestoria/StoneGolem.cpp b/Adventures in Lestoria/StoneGolem.cpp index 23e05536..82565f2c 100644 --- a/Adventures in Lestoria/StoneGolem.cpp +++ b/Adventures in Lestoria/StoneGolem.cpp @@ -64,6 +64,8 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str STONE_THROW_FINISH_ANIMATION, SHOCKWAVE, FIX_SAFE_AREAS, + DOUBLE_ROCK_TOSS, + STONE_RAIN, }; const auto PrepareSafeAreas=[&](){ @@ -230,6 +232,7 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str CreateBullet(LargeStone)(m.GetPos()+vf2d{0,ConfigFloat("Standard Attack.Stone Throw Height Offset")/2.f},ConfigFloat("Standard Attack.Stone Throw Time"),m.V(A::LOCKON_POS),m.F(A::CASTING_TIMER),ConfigPixels("Standard Attack.Stone Radius"),ConfigFloat("Standard Attack.Stone Throw Height Offset"),acc,ConfigInt("Standard Attack.Stone Damage"),ConfigFloat("Standard Attack.Stone Throw Knockback Factor"),m.OnUpperLevel(),false,INFINITY,false,WHITE,vf2d{1,1}*m.GetSizeMult(),util::random(2*PI))EndBullet; }else{ m.phase=BEAR_ATTACK; + m.F(A::CHASE_TIMER)=0.f; } }break; case STONE_THROW_CAST:{ @@ -294,6 +297,7 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str }else m.F(A::SAFE_AREA_WAIT_TIMER)-=fElapsedTime; }break; case BEAR_ATTACK:{ + m.F(A::CHASE_TIMER)+=fElapsedTime; BEAR(m,fElapsedTime,"Bear"); //Extending the bear script's variables to read the state of it... const bool SlamHasFinished=m.I(A::ATTACK_COUNT)!=m.I(A::BEAR_STOMP_COUNT); //The bear script uses the internal phase variable to determine the state of things. @@ -301,8 +305,28 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str m.phase=STANDARD; m.I(A::ATTACK_COUNT)=m.I(A::BEAR_STOMP_COUNT); }else - if(m.I(A::PHASE)==0){ - //Walking towards... If 7 seconds or more occurs here, fallback to a different plan. + if(m.I(A::PHASE)==0&&m.F(A::CHASE_TIMER)>=ConfigFloat("Max Chase Time")){ + m.phase=DOUBLE_ROCK_TOSS; + m.PerformAnimation("RAISE ROCK"); + m.I(A::STONE_TOSS_COUNT)=ConfigInt("Stone Rain.Initial Stone Toss Count"); + m.F(A::STONE_TOSS_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration(); + } + }break; + case DOUBLE_ROCK_TOSS:{ + m.F(A::STONE_TOSS_TIMER)-=fElapsedTime; + if(m.F(A::STONE_TOSS_TIMER)<=0.f){ + m.F(A::STONE_TOSS_TIMER)=ConfigFloat("Stone Rain.Stone Toss Delay"); + m.I(A::STONE_TOSS_COUNT)--; + + const datafile&throwPos{Config("Stone Rain.Stone Toss Initial Throw Pos")}; + + game->AddEffect(std::make_unique(m.GetPos()+vf2d{util::random_range(throwPos.GetReal(0),throwPos.GetReal(2)),util::random_range(throwPos.GetReal(1),throwPos.GetReal(3))},10.f,"rock.png",ConfigFloat("Stone Rain.Stone Toss Delay"),ConfigFloat("Stone Rain.Stone Toss Rock Size Mult"),0.1f,vf2d{0.f,-ConfigFloat("Stone Rain.Stone Toss Throw Speed")},WHITE,util::random(2*PI),0.f)); + + if(m.I(A::STONE_TOSS_COUNT)<=0){ + m.I(A::STONE_RAIN_COUNT)=ConfigInt("Stone Rain.Stone Count"); + m.phase=STONE_RAIN; + m.PerformAnimation("CAST"); + } } }break; } diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 40faf38a..04c774a6 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 9979 +#define VERSION_BUILD 9994 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index f4ed582d..64af6fa8 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -898,6 +898,9 @@ MonsterStrategy } Stone Golem { + # How long before the Stone Golem chooses to use its stone rain attack. + Max Chase Time = 7s + Pillar Respawns { Start HP Threshold = 75% @@ -915,8 +918,6 @@ MonsterStrategy # Degrees/sec. Positive is CW, Negative is CCW. Spell Insignia Rotation Spd = 50 } - - Beginning Phase { # Number of pillars to spawn. @@ -967,6 +968,27 @@ MonsterStrategy Shockwave Fadeout Time = 0.5s Shockwave Color = 255 red, 255 green, 255 blue, 120 alpha } + Stone Rain + { + # How many stones the boss throws in the air. + Initial Stone Toss Count = 2 + # Provide a Min X, Min Y, Max X, Max Y relative to the boss' position for where the stones appear prior to being tossed. + Stone Toss Initial Throw Pos = -20, -60, 20, -40 + # Initial Rock size is 10x9 + Stone Toss Rock Size Mult = 2.0 + # How long from the stone appearing to being thrown up + Stone Toss Delay = 0.3s + Stone Toss Throw Speed = 350 + + # Number of stones that will appear. + Stone Count = 25 + # Provide a minimum and maximum time for stones to fall. + Stone Fall Delay = 2.5s, 4.0s + # How long the indicator will appear before the rock drops down. + Indicator Time = 1s + Stone Damage = 30 + Stone Radius = 50 + } } Breaking Pillar { diff --git a/Adventures in Lestoria/assets/config/Monsters.txt b/Adventures in Lestoria/assets/config/Monsters.txt index 80962db8..47a05b2a 100644 --- a/Adventures in Lestoria/assets/config/Monsters.txt +++ b/Adventures in Lestoria/assets/config/Monsters.txt @@ -23,7 +23,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 10, 0.1, Repeat @@ -63,7 +63,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 10, 0.1, Repeat @@ -103,7 +103,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 10, 0.1, Repeat @@ -143,7 +143,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 10, 0.1, Repeat @@ -192,7 +192,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 7, 0.1, PingPong @@ -236,7 +236,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 10, 0.1, Repeat @@ -275,7 +275,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 3, 0.2, PingPong @@ -313,7 +313,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 4, 0.13, PingPong @@ -351,7 +351,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 4, 0.3, Repeat @@ -418,7 +418,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 4, 0.3, Repeat @@ -463,7 +463,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 10, 0.1, Repeat @@ -510,7 +510,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 1, 0.6, Repeat @@ -551,7 +551,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 2, 0.6, Repeat @@ -592,7 +592,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 2, 0.6, Repeat @@ -630,7 +630,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 2, 0.6, Repeat @@ -672,7 +672,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 1, 0.6, Repeat @@ -721,7 +721,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 1, 0.6, Repeat @@ -763,7 +763,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 2, 0.6, Repeat @@ -811,7 +811,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 4, 0.4, OneShot @@ -873,7 +873,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 1, 0.6, Repeat @@ -917,7 +917,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 1, 0.6, Repeat @@ -962,7 +962,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 1, 0.6, Repeat @@ -1029,7 +1029,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. IDLE = 2, 0.6, Repeat @@ -1041,6 +1041,7 @@ Monsters TOSS ROCK CAST = 2, 0.2, Repeat SLAM = 3, 0.15, OneShot TOSS ROCK = 3, 0.2, OneShot + RAISE ROCK = 3, 0.2, ReverseOneShot } Ignore Collisions = True @@ -1083,7 +1084,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. NORMAL = 4, 0.4, OneShot @@ -1133,7 +1134,7 @@ Monsters Animations { - # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse,ReverseOneShot) # Animations must be defined in the same order as they are in their sprite sheets # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. NORMAL = 4, 0.4, OneShot diff --git a/Adventures in Lestoria/olcUTIL_Animate2D.h b/Adventures in Lestoria/olcUTIL_Animate2D.h index 6d0b689b..14498445 100644 --- a/Adventures in Lestoria/olcUTIL_Animate2D.h +++ b/Adventures in Lestoria/olcUTIL_Animate2D.h @@ -99,6 +99,7 @@ namespace olc::utils::Animate2D Repeat, // Cycle through, go back to beginning OneShot, // Play once and suspend on final frame PingPong, // Traverse through forwards, then backwards + ReverseOneShot, // Cycle through sequence backwards and suspend on final frame Reverse, // Cycle through sequence backwards }; @@ -146,6 +147,7 @@ namespace olc::utils::Animate2D { case Style::Repeat: case Style::OneShot: + case Style::ReverseOneShot: return m_vFrames.size()*m_fFrameDuration; case Style::PingPong: case Style::Reverse: //These two require twice as much time (minus one frame) to complete a full animation cycle. @@ -161,6 +163,7 @@ namespace olc::utils::Animate2D { case Style::Repeat: case Style::OneShot: + case Style::ReverseOneShot: return m_vFrames.size(); case Style::PingPong: case Style::Reverse: //These two require twice as much time (minus one frame) to complete a full animation cycle. @@ -177,19 +180,18 @@ namespace olc::utils::Animate2D { switch (m_nStyle) { - case Style::Repeat: - return size_t(fTime * m_fFrameRate) % m_vFrames.size(); - break; - case Style::OneShot: - return std::clamp(size_t(fTime * m_fFrameRate), size_t(0), m_vFrames.size() - 1); - break; - case Style::PingPong:{ + case Style::Repeat: + return size_t(fTime * m_fFrameRate) % m_vFrames.size(); + case Style::OneShot: + return std::clamp(size_t(fTime * m_fFrameRate), size_t(0), m_vFrames.size() - 1); + case Style::PingPong:{ size_t frame=size_t(m_fFrameRate*fTime) % (m_vFrames.size()*size_t(2)-size_t(1)); return frame>=m_vFrames.size()?m_vFrames.size()-frame%m_vFrames.size()-1:frame; }break; - case Style::Reverse: - return (m_vFrames.size() - 1) - (size_t(fTime * m_fFrameRate) % m_vFrames.size()); - break; + case Style::ReverseOneShot: + return std::clamp((m_vFrames.size() - 1) - size_t(fTime * m_fFrameRate), size_t(0), m_vFrames.size() - 1); + case Style::Reverse: + return (m_vFrames.size() - 1) - (size_t(fTime * m_fFrameRate) % m_vFrames.size()); } return 0; diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index eaceab04..b428b232 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ