diff --git a/Crawler/Monster.cpp b/Crawler/Monster.cpp index 39b833fa..71ad4f36 100644 --- a/Crawler/Monster.cpp +++ b/Crawler/Monster.cpp @@ -276,23 +276,7 @@ bool Monster::SetPosition(vf2d pos){ return SetX(pos.x)|SetY(pos.y); } AnimationState Monster::GetDeathAnimationName(){ - switch(type){ - case SLIME_GREEN:{ - return AnimationState::GREEN_SLIME_DIE; - } - case SLIME_BLUE:{ - return AnimationState::BLUE_SLIME_DIE; - } - case SLIME_RED:{ - return AnimationState::RED_SLIME_DIE; - } - case SLIME_YELLOW:{ - return AnimationState::YELLOW_SLIME_DIE; - } - default:{ - return AnimationState::WARRIOR_IDLE_S; - } - } + return MONSTER_DATA[type].GetDeathAnimation(); } bool Monster::Hurt(int damage){ if(hp<=0) return false; diff --git a/Crawler/Monster.h b/Crawler/Monster.h index 1d32b8cf..988077b1 100644 --- a/Crawler/Monster.h +++ b/Crawler/Monster.h @@ -34,11 +34,11 @@ struct MonsterData{ int collisionDmg; AnimationState jumpAnimation=AnimationState::WARRIOR_IDLE_S; AnimationState shootAnimation=AnimationState::WARRIOR_IDLE_S; + AnimationState deathAnimation=AnimationState::WARRIOR_IDLE_S; public: MonsterData(); //When specifying animations, the first one will become the default animation. The last becomes the death animation. - MonsterData(MonsterName type,int hp,int atk,std::vectoranimations,float moveSpd=1.0f,float size=1.0f,MonsterStrategy strategy=RUN_TOWARDS,int collisionDmg=0 - ,AnimationState jumpAnimation=AnimationState::WARRIOR_IDLE_S,AnimationState shootAnimation=AnimationState::WARRIOR_IDLE_S); + MonsterData(MonsterName type,int hp,int atk,std::vectoranimations,AnimationState jumpAnimation,AnimationState shootAnimation,AnimationState deathAnimation,float moveSpd=1.0f,float size=1.0f,MonsterStrategy strategy=RUN_TOWARDS,int collisionDmg=0); int GetHealth(); int GetAttack(); float GetMoveSpdMult(); @@ -48,6 +48,7 @@ struct MonsterData{ int GetCollisionDmg(); AnimationState GetJumpAnimation(); AnimationState GetShootAnimation(); + AnimationState GetDeathAnimation(); std::vectorGetAnimations(){ return animations; } diff --git a/Crawler/MonsterData.cpp b/Crawler/MonsterData.cpp index 68f638f7..fb8867a2 100644 --- a/Crawler/MonsterData.cpp +++ b/Crawler/MonsterData.cpp @@ -4,18 +4,23 @@ std::mapMONSTER_DATA={ - {SLIME_GREEN,MonsterData(MonsterName::SLIME_GREEN,10,5,{{AnimationState::GREEN_SLIME_IDLE,AnimationState::GREEN_SLIME_JUMP,AnimationState::GREEN_SLIME_ROLL,AnimationState::GREEN_SLIME_DIE,AnimationState::GREEN_SLIME_SPIT}},1.1f,0.8f,MonsterStrategy::RUN_TOWARDS,5,AnimationState::GREEN_SLIME_JUMP,AnimationState::GREEN_SLIME_SPIT)}, - {SLIME_BLUE,MonsterData(MonsterName::SLIME_BLUE,30,10,{{AnimationState::BLUE_SLIME_IDLE,AnimationState::BLUE_SLIME_JUMP,AnimationState::BLUE_SLIME_ROLL,AnimationState::BLUE_SLIME_DIE,AnimationState::BLUE_SLIME_SPIT}},0.8f,1.0f,MonsterStrategy::SHOOT_AFAR,0,AnimationState::BLUE_SLIME_JUMP,AnimationState::BLUE_SLIME_SPIT)}, - {SLIME_RED,MonsterData(MonsterName::SLIME_RED,25,10,{{AnimationState::RED_SLIME_IDLE,AnimationState::RED_SLIME_JUMP,AnimationState::RED_SLIME_ROLL,AnimationState::RED_SLIME_DIE,AnimationState::RED_SLIME_SPIT}},0.95f,1.2f,MonsterStrategy::RUN_TOWARDS,10,AnimationState::RED_SLIME_JUMP,AnimationState::RED_SLIME_SPIT)}, - {SLIME_YELLOW,MonsterData(MonsterName::SLIME_YELLOW,175,10,{{AnimationState::YELLOW_SLIME_IDLE,AnimationState::YELLOW_SLIME_JUMP,AnimationState::YELLOW_SLIME_ROLL,AnimationState::YELLOW_SLIME_DIE,AnimationState::YELLOW_SLIME_SPIT}},0.4f,1.6f,MonsterStrategy::RUN_TOWARDS,15,AnimationState::YELLOW_SLIME_JUMP,AnimationState::YELLOW_SLIME_SPIT)}, + {SLIME_GREEN,MonsterData(MonsterName::SLIME_GREEN,10,5, + {{AnimationState::GREEN_SLIME_IDLE,AnimationState::GREEN_SLIME_JUMP,AnimationState::GREEN_SLIME_ROLL,AnimationState::GREEN_SLIME_DIE,AnimationState::GREEN_SLIME_SPIT}},AnimationState::GREEN_SLIME_JUMP,AnimationState::GREEN_SLIME_SPIT,AnimationState::GREEN_SLIME_DIE + ,1.1f,0.8f,MonsterStrategy::RUN_TOWARDS,5)}, + {SLIME_BLUE,MonsterData(MonsterName::SLIME_BLUE,30,10,{{AnimationState::BLUE_SLIME_IDLE,AnimationState::BLUE_SLIME_JUMP,AnimationState::BLUE_SLIME_ROLL,AnimationState::BLUE_SLIME_DIE,AnimationState::BLUE_SLIME_SPIT}},AnimationState::BLUE_SLIME_JUMP,AnimationState::BLUE_SLIME_SPIT,AnimationState::BLUE_SLIME_DIE + ,0.8f,1.0f,MonsterStrategy::SHOOT_AFAR,0)}, + {SLIME_RED,MonsterData(MonsterName::SLIME_RED,25,10,{{AnimationState::RED_SLIME_IDLE,AnimationState::RED_SLIME_JUMP,AnimationState::RED_SLIME_ROLL,AnimationState::RED_SLIME_DIE,AnimationState::RED_SLIME_SPIT}},AnimationState::RED_SLIME_JUMP,AnimationState::RED_SLIME_SPIT,AnimationState::RED_SLIME_DIE + ,0.95f,1.2f,MonsterStrategy::RUN_TOWARDS,10)}, + {SLIME_YELLOW,MonsterData(MonsterName::SLIME_YELLOW,175,10,{{AnimationState::YELLOW_SLIME_IDLE,AnimationState::YELLOW_SLIME_JUMP,AnimationState::YELLOW_SLIME_ROLL,AnimationState::YELLOW_SLIME_DIE,AnimationState::YELLOW_SLIME_SPIT}},AnimationState::YELLOW_SLIME_JUMP,AnimationState::YELLOW_SLIME_SPIT,AnimationState::YELLOW_SLIME_DIE + ,0.4f,1.6f,MonsterStrategy::RUN_TOWARDS,15)}, }; MonsterData::MonsterData(){} -MonsterData::MonsterData(MonsterName type,int hp,int atk,std::vectoranimations,float moveSpd,float size,MonsterStrategy strategy,int collisionDmg - ,AnimationState jumpAnimation,AnimationState shootAnimation): +MonsterData::MonsterData(MonsterName type,int hp,int atk,std::vectoranimations,AnimationState jumpAnimation,AnimationState shootAnimation,AnimationState deathAnimation + ,float moveSpd,float size,MonsterStrategy strategy,int collisionDmg): type(type),hp(hp),atk(atk),moveSpd(moveSpd),size(size),strategy(strategy),animations(animations),collisionDmg(collisionDmg) - ,jumpAnimation(jumpAnimation),shootAnimation(shootAnimation){ + ,jumpAnimation(jumpAnimation),shootAnimation(shootAnimation),deathAnimation(deathAnimation){ } int MonsterData::GetHealth(){ return hp; @@ -44,4 +49,9 @@ AnimationState MonsterData::GetJumpAnimation(){ } AnimationState MonsterData::GetShootAnimation(){ return shootAnimation; -} \ No newline at end of file +} + +AnimationState MonsterData::GetDeathAnimation() +{ + return deathAnimation; +} diff --git a/Crawler/Version.h b/Crawler/Version.h index 347f2e85..b9f28ce3 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -2,7 +2,7 @@ #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 369 +#define VERSION_BUILD 370 #define stringify(a) stringify_(a) #define stringify_(a) #a