Add player velocity adjustment function. Add Wind attack functionality for second bonus boss. Add overlay ease-in transparency. Release Build 9494.
This commit is contained in:
parent
d500e48e67
commit
92a3c463f7
@ -118,4 +118,6 @@ enum class Attribute{
|
|||||||
TARGET_FLYING_HEIGHT,
|
TARGET_FLYING_HEIGHT,
|
||||||
SPAWNER_TIMER,
|
SPAWNER_TIMER,
|
||||||
ATTACK_CHOICE,
|
ATTACK_CHOICE,
|
||||||
|
WIND_STRENGTH,
|
||||||
|
WIND_PHASE_TIMER,
|
||||||
};
|
};
|
@ -39,10 +39,13 @@ All rights reserved.
|
|||||||
#include "DEFINES.h"
|
#include "DEFINES.h"
|
||||||
#include "AdventuresInLestoria.h"
|
#include "AdventuresInLestoria.h"
|
||||||
#include "Overlay.h"
|
#include "Overlay.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
INCLUDE_game
|
INCLUDE_game
|
||||||
INCLUDE_ANIMATION_DATA
|
INCLUDE_ANIMATION_DATA
|
||||||
|
|
||||||
|
const float Overlay::ALPHA_TIME{0.5f};
|
||||||
|
|
||||||
Overlay::Overlay(std::string animationName,Pixel overlayCol)
|
Overlay::Overlay(std::string animationName,Pixel overlayCol)
|
||||||
:animationName(animationName),overlayCol(overlayCol){}
|
:animationName(animationName),overlayCol(overlayCol){}
|
||||||
const Pixel&Overlay::GetOverlayCol()const{
|
const Pixel&Overlay::GetOverlayCol()const{
|
||||||
@ -52,15 +55,22 @@ void Overlay::SetOverlayCol(Pixel newOverlayCol){
|
|||||||
overlayCol=newOverlayCol;
|
overlayCol=newOverlayCol;
|
||||||
}
|
}
|
||||||
void Overlay::Enable(){
|
void Overlay::Enable(){
|
||||||
|
alpha=0;
|
||||||
|
alphaTimer=0.f;
|
||||||
enabled=true;
|
enabled=true;
|
||||||
}
|
}
|
||||||
void Overlay::Disable(){
|
void Overlay::Disable(){
|
||||||
|
alpha=255;
|
||||||
|
alphaTimer=0.f;
|
||||||
enabled=false;
|
enabled=false;
|
||||||
}
|
}
|
||||||
void Overlay::Draw(){
|
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())};
|
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(){
|
void Overlay::Reset(){
|
||||||
animationName="pixel.png";
|
animationName="pixel.png";
|
||||||
|
@ -53,4 +53,7 @@ private:
|
|||||||
bool enabled{true};
|
bool enabled{true};
|
||||||
std::string animationName;
|
std::string animationName;
|
||||||
Pixel overlayCol;
|
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()));
|
ERR(std::format("WARNING! The velocity vector for the player is NOT normal! Current vel:{} . Attempting manual resetting of velocity.",vel.str()));
|
||||||
vel={};
|
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){
|
if(vel.x>0){
|
||||||
vel.x=std::max(0.f,vel.x-friction*fElapsedTime);
|
vel.x=std::max(0.f,vel.x-friction*fElapsedTime);
|
||||||
} else {
|
} else {
|
||||||
@ -558,11 +563,6 @@ void Player::Update(float fElapsedTime){
|
|||||||
} else {
|
} else {
|
||||||
vel.y=std::min(0.f,vel.y+friction*fElapsedTime);
|
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()){
|
if(Menu::stack.empty()){
|
||||||
@ -1575,3 +1575,7 @@ void Player::ProximityKnockback(const vf2d centerPoint,const float knockbackFact
|
|||||||
}
|
}
|
||||||
game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*knockbackFactor);
|
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 GetAtkGrowthRate()const;
|
||||||
const float GetIframeTime()const;
|
const float GetIframeTime()const;
|
||||||
const Renderable&GetMinimapImage()const;
|
const Renderable&GetMinimapImage()const;
|
||||||
|
void AddVelocity(vf2d vel);
|
||||||
private:
|
private:
|
||||||
int hp="Warrior.BaseHealth"_I;
|
int hp="Warrior.BaseHealth"_I;
|
||||||
int mana="Player.BaseMana"_I;
|
int mana="Player.BaseMana"_I;
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 3
|
#define VERSION_PATCH 3
|
||||||
#define VERSION_BUILD 9491
|
#define VERSION_BUILD 9494
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #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){
|
if(m.GetZ()==0.f){
|
||||||
m.phase=WIND_ATTACK;
|
m.phase=WIND_ATTACK;
|
||||||
game->GetOverlay().Enable();
|
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;
|
}break;
|
||||||
case WIND_ATTACK:{
|
case WIND_ATTACK:{
|
||||||
|
m.F(A::CASTING_TIMER)-=fElapsedTime;
|
||||||
|
m.F(A::WIND_PHASE_TIMER)-=fElapsedTime;
|
||||||
|
|
||||||
const bool OnLeftLandingSite=m.I(A::ATTACK_CHOICE);
|
const bool OnLeftLandingSite=m.I(A::ATTACK_CHOICE);
|
||||||
|
|
||||||
if(OnLeftLandingSite)m.PerformAnimation("ATTACK",Direction::EAST);
|
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");
|
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Wind Attack.Wind Streak Spawn Rate");
|
||||||
}
|
}
|
||||||
#pragma endregion
|
#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;
|
}break;
|
||||||
case HALFHEALTH_PHASE:{
|
case HALFHEALTH_PHASE:{
|
||||||
|
|
||||||
|
@ -832,6 +832,19 @@ MonsterStrategy
|
|||||||
Left Landing Site = 1608, 1728
|
Left Landing Site = 1608, 1728
|
||||||
Right Landing Site = 2472, 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 Sprite = "wind_vignette.png"
|
||||||
Wind Overlay Color = 64, 64, 64, 255
|
Wind Overlay Color = 64, 64, 64, 255
|
||||||
|
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user