The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'! https://forums.lestoria.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AdventuresInLestoria/Crawler/Monster.h

74 lines
1.6 KiB

#include "olcPixelGameEngine.h"
#include "Animation.h"
#include "olcUTIL_Animate2D.h"
enum MonsterStrategy{
RUN_TOWARDS,
SHOOT_AFAR
};
struct MonsterData{
private:
int hp;
int atk;
float moveSpd;//1.0=100%
float size;
std::vector<AnimationState> animations;
MonsterStrategy strategy;
public:
MonsterData();
//When specifying animations, the first one will become the default animation.
MonsterData(int hp,int atk,std::vector<AnimationState>animations,float moveSpd=1.0f,float size=1.0f,MonsterStrategy strategy=RUN_TOWARDS);
int GetHealth();
int GetAttack();
float GetMoveSpdMult();
float GetSizeMult();
MonsterStrategy GetAIStrategy();
std::vector<AnimationState>GetAnimations(){
return animations;
}
};
enum MonsterName{
SLIME_GREEN,
SLIME_BLUE,
SLIME_RED,
SLIME_YELLOW,
};
struct Monster{
private:
vf2d pos;
int hp,maxhp;
int atk;
float moveSpd;
float size;
MonsterStrategy strategy;
Animate2D::Animation<AnimationState>animation;
Animate2D::AnimationState internal_animState;
public:
Monster();
Monster(vf2d pos,MonsterData data);
vf2d&GetPos();
int GetHealth();
int GetAttack();
float GetMoveSpdMult();
float GetSizeMult();
void UpdateAnimation(AnimationState state);
void Update(float fElapsedTime);
};
struct MonsterSpawner{
private:
vf2d pos;
int range;
std::vector<std::pair<MonsterData,vf2d>>monsters;
bool triggered;
public:
MonsterSpawner();
MonsterSpawner(vf2d pos,int range,std::vector<std::pair<MonsterData,vf2d>>monsters);
bool SpawnTriggered();
int GetRange();
vf2d GetPos();
void SetTriggered(bool trigger);
};