Setup Stone Elemental AI framework. Fix spritesheet alignment for certain animations. Setup animation data. Added casting animations.

This commit is contained in:
sigonasr2 2024-05-13 12:05:57 -05:00
parent 7292094358
commit 42b8cf5da7
8 changed files with 65 additions and 13 deletions

View File

@ -923,8 +923,6 @@
<Text Include="assets\config\audio\bgm.txt" />
<Text Include="assets\config\audio\environmentalaudio.txt" />
<Text Include="assets\config\audio\events.txt" />
<Text Include="assets\config\bgm\bgm.txt" />
<Text Include="assets\config\bgm\events.txt" />
<Text Include="assets\config\classes\Ranger.txt" />
<Text Include="assets\config\classes\Thief.txt" />
<Text Include="assets\config\classes\Trapper.txt" />
@ -960,8 +958,6 @@
<Text Include="assets\config\shops\Chapter 5 Merchants.txt" />
<Text Include="assets\config\shops\Chapter 6 Merchants.txt" />
<Text Include="assets\config\story\Chapter 1.txt" />
<Text Include="Adventures in Lestoria_Story_Chapter_1 (2).txt" />
<Text Include="Adventures in Lestoria_System_Overview.txt" />
<Text Include="Chapter_1_2nd_Boss.txt" />
<Text Include="Chapter_1_Creatures_Part_2.txt" />
<Text Include="Chapter_2_Monsters.txt" />

View File

@ -40,13 +40,58 @@ All rights reserved.
#include "Monster.h"
#include "MonsterStrategyHelpers.h"
#include "BulletTypes.h"
#include "util.h"
INCLUDE_ANIMATION_DATA
INCLUDE_BULLET_LIST
INCLUDE_game
using A=Attribute;
void Monster::STRATEGY::STONE_ELEMENTAL(Monster&m,float fElapsedTime,std::string strategy){
/*
* Every 2 seconds after completing an attack do one of the following attacks:
Casts a Stone Pillar on the location of the Player: radius 350. Hits with 3 seconds delay. Becomes an solid object (Player colision) and decays after 5 seconds again.
If the Stone pillar would hit the Stone Elemental it will move out of its range.
Shoot a Stone (bullet) in the direction of the target.
The Stone gets created in form of a Cone and tracks the player movement without moving for the first second.
Once it locks it doesnt move for another second. then it starts flying towards the player with 3x the normal Bullet speed.
Dive under earth and show up 1 second later in a random location 400-700 away from player. while emerging shoot a ring of bullets (0.5x Attack)
(maybe emerge with 200 away from anything with colision to avoid the Elemental getting stuck? Other solutions for that are welcome aswell)
if range to player > 1200 always use 3rd attack
*/
void Monster::STRATEGY::STONE_ELEMENTAL(Monster&m,float fElapsedTime,std::string strategy){
enum PhaseName{
WAITING,
STONE_PILLAR_CAST,
STONE_PILLAR_ATTACK,
SHOOT_STONE_CAST,
SHOOT_STONE_ATTACK,
DIVE_UNDERGROUND_DIG,
DIVE_UNDERGROUND_SURFACE,
};
switch(m.phase){
case WAITING:{
m.F(A::ATTACK_COOLDOWN)+=fElapsedTime;
float distToPlayer=util::distance(m.GetPos(),game->GetPlayer()->GetPos());
if(distToPlayer>=ConfigPixels("Auto Dive Range"))m.phase=DIVE_UNDERGROUND_DIG;
if(m.F(A::ATTACK_COOLDOWN)>=ConfigFloat("Attack Wait Time")){
switch(util::random()%3){
case 0:m.phase=STONE_PILLAR_CAST;break;
case 1:m.phase=SHOOT_STONE_CAST;break;
case 2:m.phase=DIVE_UNDERGROUND_DIG;break;
}
}
}break;
case STONE_PILLAR_CAST:{
}break;
case SHOOT_STONE_CAST:{
}break;
case DIVE_UNDERGROUND_DIG:{
}break;
}
}

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 9266
#define VERSION_BUILD 9268
#define stringify(a) stringify_(a)
#define stringify_(a) #a

View File

@ -719,6 +719,10 @@ MonsterStrategy
}
Stone Elemental
{
# Amount of time between attacks.
Attack Wait Time = 2s
# Minimum Distance the Stone Elemental will always perform a dive
Auto Dive Range = 1200
}
}

View File

@ -760,10 +760,12 @@ Monsters
# Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse)
# 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
JUMP = 1, 0.2, Repeat
SHOOT = 1, 0.2, OneShot
DEATH = 1, 0.15, OneShot
IDLE = 2, 0.6, Repeat
WALK = 4, 0.2, Repeat
TOSS ROCK = 4, 0.2, OneShot
DEATH = 4, 0.15, OneShot
ROCK TOSS CAST = 2, 0.3, Repeat
STONE PILLAR CAST = 2, 0.3, Repeat
}
Hurt Sound = Monster Hurt

View File

@ -201,4 +201,8 @@ float util::angle_difference(float angle_1, float angle_2)
angle_diff += 2 * PI;
return -angle_diff;
}
const float util::distance(const vf2d&point1,const vf2d&point2){
return vf2d{point1-point2}.mag();
}

View File

@ -61,6 +61,7 @@ namespace olc::util{
std::u32string WrapText(PixelGameEngine*pge,std::u32string str,int width,Font&font,vd2d scale);
float angle_difference(float angle_1, float angle_2);
std::string GetHash(std::string file);
const float distance(const vf2d&point1,const vf2d&point2);
}
template<class TL, class TR>