Implemented Seagull AI. Release Build 11673.
This commit is contained in:
parent
6b0c17b5ff
commit
9ec850fdd0
@ -57,6 +57,7 @@ MonsterData::MonsterData(std::string name,std::string displayName,int hp,int atk
|
|||||||
name(name),displayName(displayName),hp(hp),atk(atk),xp(xp),moveSpd(moveSpd),size(size),strategy(strategy),dropData(drops),collisionDmg(collisionDmg),collisionRadius(8.f*this->size){}
|
name(name),displayName(displayName),hp(hp),atk(atk),xp(xp),moveSpd(moveSpd),size(size),strategy(strategy),dropData(drops),collisionDmg(collisionDmg),collisionRadius(8.f*this->size){}
|
||||||
|
|
||||||
void MonsterData::InitializeMonsterData(){
|
void MonsterData::InitializeMonsterData(){
|
||||||
|
MONSTER_DATA.clear();
|
||||||
for(auto&[key,size]:DATA["Monsters"].GetKeys()){
|
for(auto&[key,size]:DATA["Monsters"].GetKeys()){
|
||||||
std::string MonsterName=key;
|
std::string MonsterName=key;
|
||||||
std::string MonsterImgName=MonsterName;
|
std::string MonsterImgName=MonsterName;
|
||||||
|
@ -47,5 +47,41 @@ using A=Attribute;
|
|||||||
INCLUDE_game
|
INCLUDE_game
|
||||||
|
|
||||||
void Monster::STRATEGY::SEAGULL(Monster&m,float fElapsedTime,std::string strategy){
|
void Monster::STRATEGY::SEAGULL(Monster&m,float fElapsedTime,std::string strategy){
|
||||||
|
enum PhaseName{
|
||||||
|
CHILLING,
|
||||||
|
STARTLED,
|
||||||
|
FLY_AWAY,
|
||||||
|
DISABLED,
|
||||||
|
};
|
||||||
|
|
||||||
|
switch(PHASE()){
|
||||||
|
case CHILLING:{
|
||||||
|
m.PerformAnimation("IDLE",game->GetPlayer()->GetPos());
|
||||||
|
float distToPlayer{util::distance(game->GetPlayer()->GetPos(),m.GetPos())};
|
||||||
|
if(distToPlayer<=ConfigFloat("Startled Range")/100.f*24){
|
||||||
|
SETPHASE(STARTLED);
|
||||||
|
m.F(A::CASTING_TIMER)=ConfigFloat("Takeoff Time");
|
||||||
|
m.V(A::PREV_POS)=m.GetPos();
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case STARTLED:{
|
||||||
|
m.PerformAnimation("FLY",m.GetPos()+util::pointTo(game->GetPlayer()->GetPos(),m.GetPos()));
|
||||||
|
m.F(A::CASTING_TIMER)-=fElapsedTime;
|
||||||
|
if(m.F(A::CASTING_TIMER)<=0.f)SETPHASE(FLY_AWAY);
|
||||||
|
}break;
|
||||||
|
case FLY_AWAY:{
|
||||||
|
vf2d moveVec{m.GetPos().x-game->GetPlayer()->GetPos().x,0.f};
|
||||||
|
m.PerformAnimation("FLY",m.GetPos()+util::pointTo(game->GetPlayer()->GetPos(),m.GetPos()));
|
||||||
|
m.MoveForward(moveVec,fElapsedTime);
|
||||||
|
m.SetVelocity({0.f,-ConfigFloat("Fly Away Z Speed")});
|
||||||
|
float distTraveled{util::distance(m.V(A::PREV_POS),m.GetPos())};
|
||||||
|
if(distTraveled>=ConfigFloat("Despawn Range")/100.f*24){
|
||||||
|
m.lifetime=1.f;
|
||||||
|
SETPHASE(DISABLED);
|
||||||
|
}
|
||||||
|
}break;
|
||||||
|
case DISABLED:{
|
||||||
|
//NO-OP
|
||||||
|
}break;
|
||||||
|
}
|
||||||
}
|
}
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 3
|
#define VERSION_MINOR 3
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 11667
|
#define VERSION_BUILD 11673
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="335" height="165" tilewidth="24" tileheight="24" infinite="0" nextlayerid="8" nextobjectid="80">
|
<map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="335" height="165" tilewidth="24" tileheight="24" infinite="0" nextlayerid="8" nextobjectid="85">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="Background Music" propertytype="BGM" value="beach"/>
|
<property name="Background Music" propertytype="BGM" value="beach"/>
|
||||||
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
|
<property name="Level Type" type="int" propertytype="LevelType" value="0"/>
|
||||||
@ -865,11 +865,6 @@
|
|||||||
<object id="8" name="Spawn Zone" type="SpawnGroup" x="180" y="1326" width="426" height="306">
|
<object id="8" name="Spawn Zone" type="SpawnGroup" x="180" y="1326" width="426" height="306">
|
||||||
<ellipse/>
|
<ellipse/>
|
||||||
</object>
|
</object>
|
||||||
<object id="15" template="../maps/Monsters/Pirate Captain.tx" x="504" y="1500">
|
|
||||||
<properties>
|
|
||||||
<property name="spawner" type="object" value="8"/>
|
|
||||||
</properties>
|
|
||||||
</object>
|
|
||||||
<object id="16" name="Waterfall" type="AudioEnvironmentalSound" x="5352" y="192">
|
<object id="16" name="Waterfall" type="AudioEnvironmentalSound" x="5352" y="192">
|
||||||
<properties>
|
<properties>
|
||||||
<property name="Sound Name" propertytype="EnvironmentalSounds" value="Waterfall"/>
|
<property name="Sound Name" propertytype="EnvironmentalSounds" value="Waterfall"/>
|
||||||
@ -1248,5 +1243,30 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<point/>
|
<point/>
|
||||||
</object>
|
</object>
|
||||||
|
<object id="80" template="../maps/Monsters/Seagull.tx" x="558" y="1494">
|
||||||
|
<properties>
|
||||||
|
<property name="spawner" type="object" value="8"/>
|
||||||
|
</properties>
|
||||||
|
</object>
|
||||||
|
<object id="81" template="../maps/Monsters/Seagull.tx" x="894" y="1338">
|
||||||
|
<properties>
|
||||||
|
<property name="spawner" type="object" value="8"/>
|
||||||
|
</properties>
|
||||||
|
</object>
|
||||||
|
<object id="82" template="../maps/Monsters/Seagull.tx" x="948" y="1464">
|
||||||
|
<properties>
|
||||||
|
<property name="spawner" type="object" value="8"/>
|
||||||
|
</properties>
|
||||||
|
</object>
|
||||||
|
<object id="83" template="../maps/Monsters/Seagull.tx" x="864" y="1584">
|
||||||
|
<properties>
|
||||||
|
<property name="spawner" type="object" value="8"/>
|
||||||
|
</properties>
|
||||||
|
</object>
|
||||||
|
<object id="84" template="../maps/Monsters/Seagull.tx" x="978" y="1584">
|
||||||
|
<properties>
|
||||||
|
<property name="spawner" type="object" value="8"/>
|
||||||
|
</properties>
|
||||||
|
</object>
|
||||||
</objectgroup>
|
</objectgroup>
|
||||||
</map>
|
</map>
|
||||||
|
@ -1114,7 +1114,10 @@ MonsterStrategy
|
|||||||
}
|
}
|
||||||
Seagull
|
Seagull
|
||||||
{
|
{
|
||||||
|
Startled Range = 1000
|
||||||
|
Takeoff Time = 2s
|
||||||
|
Despawn Range = 4000
|
||||||
|
Fly Away Z Speed = 30
|
||||||
}
|
}
|
||||||
Sandworm
|
Sandworm
|
||||||
{
|
{
|
||||||
|
5
Adventures in Lestoria/assets/maps/Monsters/Seagull.tx
Normal file
5
Adventures in Lestoria/assets/maps/Monsters/Seagull.tx
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<template>
|
||||||
|
<tileset firstgid="1" source="../Monsters.tsx"/>
|
||||||
|
<object name="Seagull" type="Monster" gid="26" width="38.4" height="38.4"/>
|
||||||
|
</template>
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user