Octopus arm AI
This commit is contained in:
parent
7b165a64d5
commit
46ba7a780d
@ -2690,7 +2690,7 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){
|
|||||||
LoadingScreen::AddPhase([&](){
|
LoadingScreen::AddPhase([&](){
|
||||||
for(NPCData data:game->MAP_DATA[game->GetCurrentLevel()].npcs){
|
for(NPCData data:game->MAP_DATA[game->GetCurrentLevel()].npcs){
|
||||||
if(Unlock::IsUnlocked(data.unlockCondition)){
|
if(Unlock::IsUnlocked(data.unlockCondition)){
|
||||||
MONSTER_LIST.push_back(std::make_unique<Monster>(data.spawnPos,MONSTER_DATA[data.name]));
|
MONSTER_LIST.emplace_back(std::make_unique<Monster>(data.spawnPos,MONSTER_DATA[data.name]));
|
||||||
MONSTER_LIST.back()->ApplyIframes(INFINITE);
|
MONSTER_LIST.back()->ApplyIframes(INFINITE);
|
||||||
MONSTER_LIST.back()->npcData=data;
|
MONSTER_LIST.back()->npcData=data;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +41,7 @@ All rights reserved.
|
|||||||
#include "AdventuresInLestoria.h"
|
#include "AdventuresInLestoria.h"
|
||||||
#include "SoundEffect.h"
|
#include "SoundEffect.h"
|
||||||
#include "BulletTypes.h"
|
#include "BulletTypes.h"
|
||||||
|
#include "Arc.h"
|
||||||
|
|
||||||
using A=Attribute;
|
using A=Attribute;
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
|
|||||||
INIT,
|
INIT,
|
||||||
RISE_ANIMATION,
|
RISE_ANIMATION,
|
||||||
SEARCH,
|
SEARCH,
|
||||||
|
PREPARE_ATTACK,
|
||||||
};
|
};
|
||||||
switch(PHASE()){
|
switch(PHASE()){
|
||||||
case INIT:{
|
case INIT:{
|
||||||
@ -66,7 +68,36 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
|
|||||||
}
|
}
|
||||||
}break;
|
}break;
|
||||||
case SEARCH:{
|
case SEARCH:{
|
||||||
|
if(util::distance(m.GetPos(),game->GetPlayer()->GetPos())<="Attack Radius"_F/100.f*24){
|
||||||
|
SETPHASE(PREPARE_ATTACK);
|
||||||
|
m.F(A::ATTACK_COOLDOWN)="Attack Wiggle Time Range"_FRange;
|
||||||
|
m.PerformAnimation("ATTACKING",game->GetPlayer()->GetPos());
|
||||||
|
float arcAngle{};
|
||||||
|
switch(m.GetFacingDirection()){
|
||||||
|
case Direction::NORTH:{
|
||||||
|
arcAngle=-PI/2;
|
||||||
|
}break;
|
||||||
|
case Direction::EAST:{
|
||||||
|
arcAngle=0.f;
|
||||||
|
}break;
|
||||||
|
case Direction::WEST:{
|
||||||
|
arcAngle=PI;
|
||||||
|
}break;
|
||||||
|
case Direction::SOUTH:{
|
||||||
|
arcAngle=PI/2;
|
||||||
|
}break;
|
||||||
|
}
|
||||||
|
Arc attackArc{m.GetPos(),"Attack Radius"_F/100.f*24,arcAngle,util::degToRad("Attack Arc"_F)};
|
||||||
|
m.SetStrategyDrawFunction([&attackArc](AiL*game,Monster&monster,const std::string&strategy){
|
||||||
|
attackArc.Draw(game,BLUE);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case PREPARE_ATTACK:{
|
||||||
|
m.F(A::ATTACK_COOLDOWN)-=fElapsedTime;
|
||||||
|
if(m.F(A::ATTACK_COOLDOWN)<=0.f){
|
||||||
|
|
||||||
|
}
|
||||||
}break;
|
}break;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1200,4 +1200,12 @@ MonsterStrategy
|
|||||||
# Amount of movespeed gain by end of rampup time.
|
# Amount of movespeed gain by end of rampup time.
|
||||||
Movespeed Rampup Final Amount = 100%
|
Movespeed Rampup Final Amount = 100%
|
||||||
}
|
}
|
||||||
|
Octopus Arm
|
||||||
|
{
|
||||||
|
Attack Radius = 600
|
||||||
|
|
||||||
|
Attack Wiggle Time Range = 2s,4s
|
||||||
|
Attack Arc = 60deg
|
||||||
|
Attack Wait Time = 1s
|
||||||
|
}
|
||||||
}
|
}
|
@ -70,6 +70,7 @@ vf2d operator ""_V(const char*key,std::size_t len);
|
|||||||
utils::datafile operator ""_A(const char*key,std::size_t len);
|
utils::datafile operator ""_A(const char*key,std::size_t len);
|
||||||
|
|
||||||
Pixel operator ""_Pixel(const char*key,std::size_t len);
|
Pixel operator ""_Pixel(const char*key,std::size_t len);
|
||||||
|
//Outputs a number between two range values provided.
|
||||||
float operator ""_FRange(const char*key,std::size_t len);
|
float operator ""_FRange(const char*key,std::size_t len);
|
||||||
float operator ""_Pct(long double pct);
|
float operator ""_Pct(long double pct);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user