Add player velocity adjustment function. Add Wind attack functionality for second bonus boss. Add overlay ease-in transparency. Release Build 9494.

pull/57/head
sigonasr2 6 months ago
parent d500e48e67
commit 92a3c463f7
  1. 2
      Adventures in Lestoria/MonsterAttribute.h
  2. 14
      Adventures in Lestoria/Overlay.cpp
  3. 3
      Adventures in Lestoria/Overlay.h
  4. 14
      Adventures in Lestoria/Player.cpp
  5. 1
      Adventures in Lestoria/Player.h
  6. 2
      Adventures in Lestoria/Version.h
  7. 25
      Adventures in Lestoria/Zephy.cpp
  8. 13
      Adventures in Lestoria/assets/config/MonsterStrategies.txt
  9. BIN
      x64/Release/Adventures in Lestoria.exe

@ -118,4 +118,6 @@ enum class Attribute{
TARGET_FLYING_HEIGHT,
SPAWNER_TIMER,
ATTACK_CHOICE,
WIND_STRENGTH,
WIND_PHASE_TIMER,
};

@ -39,10 +39,13 @@ All rights reserved.
#include "DEFINES.h"
#include "AdventuresInLestoria.h"
#include "Overlay.h"
#include "util.h"
INCLUDE_game
INCLUDE_ANIMATION_DATA
const float Overlay::ALPHA_TIME{0.5f};
Overlay::Overlay(std::string animationName,Pixel overlayCol)
:animationName(animationName),overlayCol(overlayCol){}
const Pixel&Overlay::GetOverlayCol()const{
@ -52,15 +55,22 @@ void Overlay::SetOverlayCol(Pixel newOverlayCol){
overlayCol=newOverlayCol;
}
void Overlay::Enable(){
alpha=0;
alphaTimer=0.f;
enabled=true;
}
void Overlay::Disable(){
alpha=255;
alphaTimer=0.f;
enabled=false;
}
void Overlay::Draw(){
if(!enabled)return;
alphaTimer+=game->GetElapsedTime();
if(enabled)alpha=util::lerp(0,255,std::min(1.f,alphaTimer/ALPHA_TIME));
else alpha=util::lerp(255,0,std::min(1.f,alphaTimer/ALPHA_TIME));
const Animate2D::Frame&animationFrame{ANIMATION_DATA.at(animationName).GetFrame(game->GetRunTime())};
game->DrawPartialDecal({},animationFrame.GetSourceRect().size,animationFrame.GetSourceImage()->Decal(),animationFrame.GetSourceRect().pos,animationFrame.GetSourceRect().size,overlayCol);
game->DrawPartialDecal({},animationFrame.GetSourceRect().size,animationFrame.GetSourceImage()->Decal(),animationFrame.GetSourceRect().pos,animationFrame.GetSourceRect().size,{overlayCol.r,overlayCol.g,overlayCol.b,uint8_t(overlayCol.a*uint8_t(alpha/255.f))});
}
void Overlay::Reset(){
animationName="pixel.png";

@ -53,4 +53,7 @@ private:
bool enabled{true};
std::string animationName;
Pixel overlayCol;
uint8_t alpha{255};
float alphaTimer{0.f};
static const float ALPHA_TIME;
};

@ -548,6 +548,11 @@ void Player::Update(float fElapsedTime){
ERR(std::format("WARNING! The velocity vector for the player is NOT normal! Current vel:{} . Attempting manual resetting of velocity.",vel.str()));
vel={};
}
if(vel!=vf2d{0,0}){
float newX=pos.x+vel.x*fElapsedTime;
float newY=pos.y+vel.y*fElapsedTime;
SetX(newX);
SetY(newY);
if(vel.x>0){
vel.x=std::max(0.f,vel.x-friction*fElapsedTime);
} else {
@ -558,11 +563,6 @@ void Player::Update(float fElapsedTime){
} else {
vel.y=std::min(0.f,vel.y+friction*fElapsedTime);
}
if(vel!=vf2d{0,0}){
float newX=pos.x+vel.x*fElapsedTime;
float newY=pos.y+vel.y*fElapsedTime;
SetX(newX);
SetY(newY);
}
if(Menu::stack.empty()){
@ -1575,3 +1575,7 @@ void Player::ProximityKnockback(const vf2d centerPoint,const float knockbackFact
}
game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*knockbackFactor);
}
void Player::AddVelocity(vf2d vel){
this->vel+=vel;
}

@ -256,6 +256,7 @@ public:
const float GetAtkGrowthRate()const;
const float GetIframeTime()const;
const Renderable&GetMinimapImage()const;
void AddVelocity(vf2d vel);
private:
int hp="Warrior.BaseHealth"_I;
int mana="Player.BaseMana"_I;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 9491
#define VERSION_BUILD 9494
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -200,9 +200,15 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy)
if(m.GetZ()==0.f){
m.phase=WIND_ATTACK;
game->GetOverlay().Enable();
m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration");
m.F(A::WIND_STRENGTH)=ConfigFloat("Wind Attack.Wind Starting Strength")/100.f;
m.F(A::WIND_PHASE_TIMER)=ConfigFloat("Wind Attack.Wind Increase Phase Wait Time");
}
}break;
case WIND_ATTACK:{
m.F(A::CASTING_TIMER)-=fElapsedTime;
m.F(A::WIND_PHASE_TIMER)-=fElapsedTime;
const bool OnLeftLandingSite=m.I(A::ATTACK_CHOICE);
if(OnLeftLandingSite)m.PerformAnimation("ATTACK",Direction::EAST);
@ -238,6 +244,25 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy)
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Wind Attack.Wind Streak Spawn Rate");
}
#pragma endregion
if(m.F(A::WIND_STRENGTH)<ConfigFloat("Wind Attack.Wind Max Strength")/100.f&&m.F(A::WIND_PHASE_TIMER)<=0.f){
m.F(A::WIND_STRENGTH)=std::min(ConfigFloat("Wind Attack.Wind Max Strength")/100.f,m.F(A::WIND_STRENGTH)+ConfigFloat("Wind Attack.Wind Strength Increase")/100.f);
m.F(A::WIND_PHASE_TIMER)=ConfigFloat("Wind Attack.Wind Increase Phase Wait Time");
}
#pragma region Wind
const bool LeftLandingSite=m.I(A::ATTACK_CHOICE);
vf2d windSpd={m.F(A::WIND_STRENGTH)*"Player.MoveSpd"_F,0.f}; //Assume we landed left and causing a wind attack to the right.
if(!LeftLandingSite)windSpd*=-1;
game->GetPlayer()->AddVelocity(windSpd);
m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration");
#pragma endregion
if(m.F(A::CASTING_TIMER)<=0.f){
m.phase=IDLE;
game->GetOverlay().Disable();
}
}break;
case HALFHEALTH_PHASE:{

@ -832,6 +832,19 @@ MonsterStrategy
Left Landing Site = 1608, 1728
Right Landing Site = 2472, 1728
Wind Starting Strength = 10%
# Amount of increase per wind stage.
Wind Strength Increase = 10%
Wind Max Strength = 60%
# How much time between each stage.
Wind Increase Phase Wait Time = 1s
# Total amount of time of the attack.
Wind Duration = 18s
Wind Projectile Spawn Rate = 0.5s
Wind Projectile X Speed Range = 120px/s, 240px/s
Wind Projectile Y Speed Range = -32px/s, 32px/s
Wind Overlay Sprite = "wind_vignette.png"
Wind Overlay Color = 64, 64, 64, 255

Loading…
Cancel
Save