Super big refactor of the animation storage and monster storage system using configuration files.

pull/28/head
sigonasr2 1 year ago
parent 1c2106135d
commit 13eff22485
  1. 250
      Crawler/Animation.cpp
  2. 26
      Crawler/Animation.h
  3. 6
      Crawler/Arrow.cpp
  4. 3
      Crawler/Bullet.cpp
  5. 4
      Crawler/Bullet.h
  6. 4
      Crawler/ChargedArrow.cpp
  7. 11
      Crawler/Crawler.cpp
  8. 3
      Crawler/Crawler.vcxproj
  9. 9
      Crawler/Crawler.vcxproj.filters
  10. 36
      Crawler/DEFINES.h
  11. 5
      Crawler/Effect.cpp
  12. 10
      Crawler/Effect.h
  13. 8
      Crawler/EnergyBolt.cpp
  14. 10
      Crawler/FireBolt.cpp
  15. 16
      Crawler/LightningBolt.cpp
  16. 4
      Crawler/LightningBoltEmitter.cpp
  17. 6
      Crawler/Meteor.cpp
  18. 20
      Crawler/Monster.cpp
  19. 35
      Crawler/Monster.h
  20. 60
      Crawler/MonsterData.cpp
  21. 39
      Crawler/Player.cpp
  22. 130
      Crawler/Player.h
  23. 17
      Crawler/PulsatingFire.cpp
  24. 16
      Crawler/Ranger.cpp
  25. 16
      Crawler/Thief.cpp
  26. 16
      Crawler/Trapper.cpp
  27. 2
      Crawler/Version.h
  28. 36
      Crawler/Warrior.cpp
  29. 16
      Crawler/Witch.cpp
  30. 60
      Crawler/Wizard.cpp
  31. 69
      Crawler/assets/config/MonsterStrategies.txt
  32. 83
      Crawler/assets/config/Monsters.txt
  33. 6
      Crawler/assets/config/configuration.txt
  34. 27
      Crawler/assets/propertytypes.xml
  35. 3
      Crawler/safemap.cpp
  36. 19
      Crawler/safemap.h

@ -1,19 +1,20 @@
#include "Animation.h"
#include "Crawler.h"
#include "DEFINES.h"
#include "safemap.h"
INCLUDE_game
INCLUDE_ANIMATION_DATA
void sig::Animation::InitializeAnimations(){
auto CreateStillAnimation=[&](Renderable&img,vf2d size,AnimationState state,AnimationData data={}){
auto CreateStillAnimation=[&](Renderable&img,vf2d size,std::string state,AnimationData data={}){
Animate2D::FrameSequence anim(data.frameDuration,data.style);
anim.AddFrame({&img,{{0,0},size}});
ANIMATION_DATA[state]=anim;
};
auto CreateHorizontalAnimationSequence=[&](Renderable&img,int frameCount,vf2d size,AnimationState state,AnimationData data={}){
auto CreateHorizontalAnimationSequence=[&](Renderable&img,int frameCount,vf2d size,std::string state,AnimationData data={}){
Animate2D::FrameSequence anim(data.frameDuration,data.style);
for(int i=0;i<frameCount;i++){
anim.AddFrame({&img,{{int(i*size.x),0},size}});
@ -21,47 +22,47 @@ void sig::Animation::InitializeAnimations(){
ANIMATION_DATA[state]=anim;
};
auto SetupClassWalkIdleAnimations=[&](Renderable&sheet,AnimationState WALK_S_ANIMATION){
auto SetupClassWalkIdleAnimations=[&](Renderable&sheet,std::string className){
Animate2D::FrameSequence pl_walk_s{0.2};
pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{1,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
pl_walk_s.AddFrame({&sheet,{vi2d{2,0}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+0)]=pl_walk_s;
ANIMATION_DATA[className+"_WALK_S"]=pl_walk_s;
Animate2D::FrameSequence pl_walk_e{0.2};
pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{1,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
pl_walk_e.AddFrame({&sheet,{vi2d{2,3}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+1)]=pl_walk_e;
ANIMATION_DATA[className+"_WALK_E"]=pl_walk_e;
Animate2D::FrameSequence pl_walk_w{0.2};
pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{1,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
pl_walk_w.AddFrame({&sheet,{vi2d{2,2}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+3)]=pl_walk_w;
ANIMATION_DATA[className+"_WALK_W"]=pl_walk_w;
Animate2D::FrameSequence pl_walk_n{0.2};
pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{1,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});
pl_walk_n.AddFrame({&sheet,{vi2d{2,1}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+2)]=pl_walk_n;
ANIMATION_DATA[className+"_WALK_N"]=pl_walk_n;
Animate2D::FrameSequence pl_idle_s;
pl_idle_s.AddFrame({&sheet,{vi2d{0,0}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+4)]=pl_idle_s;
ANIMATION_DATA[className+"_IDLE_S"]=pl_idle_s;
Animate2D::FrameSequence pl_idle_e;
pl_idle_e.AddFrame({&sheet,{vi2d{0,3}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+5)]=pl_idle_e;
ANIMATION_DATA[className+"_IDLE_E"]=pl_idle_e;
Animate2D::FrameSequence pl_idle_w;
pl_idle_w.AddFrame({&sheet,{vi2d{0,2}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+7)]=pl_idle_w;
ANIMATION_DATA[className+"_IDLE_W"]=pl_idle_w;
Animate2D::FrameSequence pl_idle_n;
pl_idle_n.AddFrame({&sheet,{vi2d{0,1}*24,{24,24}}});
ANIMATION_DATA[AnimationState(WALK_S_ANIMATION+6)]=pl_idle_n;
ANIMATION_DATA[className+"_IDLE_N"]=pl_idle_n;
};
//Warrior animations.
SetupClassWalkIdleAnimations(game->GFX_Warrior_Sheet,AnimationState::WARRIOR_WALK_S);
SetupClassWalkIdleAnimations(game->GFX_Warrior_Sheet,"WARRIOR");
Animate2D::FrameSequence pl_warrior_swing_s(0.05),pl_warrior_swing_n(0.05),pl_warrior_swing_e(0.05),pl_warrior_swing_w(0.05);
Animate2D::FrameSequence pl_warrior_sonic_swing_s(0.1,Animate2D::Style::OneShot),pl_warrior_sonic_swing_n(0.1,Animate2D::Style::OneShot),pl_warrior_sonic_swing_e(0.1,Animate2D::Style::OneShot),pl_warrior_sonic_swing_w(0.1,Animate2D::Style::OneShot);
for (int i=0;i<4;i++){
@ -80,17 +81,17 @@ void sig::Animation::InitializeAnimations(){
pl_warrior_swing_e.AddFrame({&game->GFX_Warrior_Sheet,{vi2d{4+i,3}*24,{24,24}}});
pl_warrior_sonic_swing_e.AddFrame({&game->GFX_Warrior_Sheet,{vi2d{4+i,7}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSWORD_N]=pl_warrior_swing_n;
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSWORD_E]=pl_warrior_swing_e;
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSWORD_S]=pl_warrior_swing_s;
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSWORD_W]=pl_warrior_swing_w;
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSONICSWORD_N]=pl_warrior_sonic_swing_n;
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSONICSWORD_E]=pl_warrior_sonic_swing_e;
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSONICSWORD_S]=pl_warrior_sonic_swing_s;
ANIMATION_DATA[AnimationState::WARRIOR_SWINGSONICSWORD_W]=pl_warrior_sonic_swing_w;
ANIMATION_DATA["WARRIOR_SWINGSWORD_N"]=pl_warrior_swing_n;
ANIMATION_DATA["WARRIOR_SWINGSWORD_E"]=pl_warrior_swing_e;
ANIMATION_DATA["WARRIOR_SWINGSWORD_S"]=pl_warrior_swing_s;
ANIMATION_DATA["WARRIOR_SWINGSWORD_W"]=pl_warrior_swing_w;
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_N"]=pl_warrior_sonic_swing_n;
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_E"]=pl_warrior_sonic_swing_e;
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_S"]=pl_warrior_sonic_swing_s;
ANIMATION_DATA["WARRIOR_SWINGSONICSWORD_W"]=pl_warrior_sonic_swing_w;
//Ranger animations
SetupClassWalkIdleAnimations(game->GFX_Ranger_Sheet,AnimationState::RANGER_WALK_S);
SetupClassWalkIdleAnimations(game->GFX_Ranger_Sheet,"RANGER");
Animate2D::FrameSequence pl_ranger_shoot_s,pl_ranger_shoot_n,pl_ranger_shoot_e,pl_ranger_shoot_w;
for(int i=0;i<3;i++){
pl_ranger_shoot_s.AddFrame({&game->GFX_Ranger_Sheet,{vi2d{3+i,0}*24,{24,24}}});
@ -98,25 +99,25 @@ void sig::Animation::InitializeAnimations(){
pl_ranger_shoot_e.AddFrame({&game->GFX_Ranger_Sheet,{vi2d{3+i,3}*24,{24,24}}});
pl_ranger_shoot_w.AddFrame({&game->GFX_Ranger_Sheet,{vi2d{3+i,2}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState::RANGER_SHOOT_S]=pl_ranger_shoot_s;
ANIMATION_DATA[AnimationState::RANGER_SHOOT_N]=pl_ranger_shoot_n;
ANIMATION_DATA[AnimationState::RANGER_SHOOT_E]=pl_ranger_shoot_e;
ANIMATION_DATA[AnimationState::RANGER_SHOOT_W]=pl_ranger_shoot_w;
ANIMATION_DATA["RANGER_SHOOT_S"]=pl_ranger_shoot_s;
ANIMATION_DATA["RANGER_SHOOT_N"]=pl_ranger_shoot_n;
ANIMATION_DATA["RANGER_SHOOT_E"]=pl_ranger_shoot_e;
ANIMATION_DATA["RANGER_SHOOT_W"]=pl_ranger_shoot_w;
//Wizard animations
SetupClassWalkIdleAnimations(game->GFX_Wizard_Sheet,AnimationState::WIZARD_WALK_S);
SetupClassWalkIdleAnimations(game->GFX_Wizard_Sheet,"WIZARD");
Animate2D::FrameSequence pl_wizard_idle_attack_s;
pl_wizard_idle_attack_s.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,0}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WIZARD_IDLE_ATTACK_S]=pl_wizard_idle_attack_s;
ANIMATION_DATA["WIZARD_IDLE_ATTACK_S"]=pl_wizard_idle_attack_s;
Animate2D::FrameSequence pl_wizard_idle_attack_e;
pl_wizard_idle_attack_e.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,3}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WIZARD_IDLE_ATTACK_E]=pl_wizard_idle_attack_e;
ANIMATION_DATA["WIZARD_IDLE_ATTACK_E"]=pl_wizard_idle_attack_e;
Animate2D::FrameSequence pl_wizard_idle_attack_w;
pl_wizard_idle_attack_w.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,2}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WIZARD_IDLE_ATTACK_W]=pl_wizard_idle_attack_w;
ANIMATION_DATA["WIZARD_IDLE_ATTACK_W"]=pl_wizard_idle_attack_w;
Animate2D::FrameSequence pl_wizard_idle_attack_n;
pl_wizard_idle_attack_n.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,1}*24,{24,24}}});
ANIMATION_DATA[AnimationState::WIZARD_IDLE_ATTACK_N]=pl_wizard_idle_attack_n;
ANIMATION_DATA["WIZARD_IDLE_ATTACK_N"]=pl_wizard_idle_attack_n;
Animate2D::FrameSequence pl_wizard_attack_s(0.2);
for(int i=0;i<3;i++){
pl_wizard_attack_s.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4+i,0}*24,{24,24}}});
@ -124,7 +125,7 @@ void sig::Animation::InitializeAnimations(){
pl_wizard_attack_s.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,0}*24,{24,24}}});
}
}
ANIMATION_DATA[AnimationState::WIZARD_ATTACK_S]=pl_wizard_attack_s;
ANIMATION_DATA["WIZARD_ATTACK_S"]=pl_wizard_attack_s;
Animate2D::FrameSequence pl_wizard_attack_e(0.2);
for(int i=0;i<3;i++){
pl_wizard_attack_e.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4+i,3}*24,{24,24}}});
@ -132,7 +133,7 @@ void sig::Animation::InitializeAnimations(){
pl_wizard_attack_e.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,3}*24,{24,24}}});
}
}
ANIMATION_DATA[AnimationState::WIZARD_ATTACK_E]=pl_wizard_attack_e;
ANIMATION_DATA["WIZARD_ATTACK_E"]=pl_wizard_attack_e;
Animate2D::FrameSequence pl_wizard_attack_w(0.2);
for(int i=0;i<3;i++){
pl_wizard_attack_w.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4+i,2}*24,{24,24}}});
@ -140,7 +141,7 @@ void sig::Animation::InitializeAnimations(){
pl_wizard_attack_w.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,2}*24,{24,24}}});
}
}
ANIMATION_DATA[AnimationState::WIZARD_ATTACK_W]=pl_wizard_attack_w;
ANIMATION_DATA["WIZARD_ATTACK_W"]=pl_wizard_attack_w;
Animate2D::FrameSequence pl_wizard_attack_n(0.2);
for(int i=0;i<3;i++){
pl_wizard_attack_n.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4+i,1}*24,{24,24}}});
@ -148,30 +149,45 @@ void sig::Animation::InitializeAnimations(){
pl_wizard_attack_n.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{4,1}*24,{24,24}}});
}
}
ANIMATION_DATA[AnimationState::WIZARD_ATTACK_N]=pl_wizard_attack_n;
ANIMATION_DATA["WIZARD_ATTACK_N"]=pl_wizard_attack_n;
Animate2D::FrameSequence pl_wizard_cast_s(0.1);
for(int i=0;i<2;i++){
pl_wizard_cast_s.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{7+i,0}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState::WIZARD_CAST_S]=pl_wizard_cast_s;
ANIMATION_DATA["WIZARD_CAST_S"]=pl_wizard_cast_s;
Animate2D::FrameSequence pl_wizard_cast_e(0.1);
for(int i=0;i<2;i++){
pl_wizard_cast_e.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{7+i,3}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState::WIZARD_CAST_E]=pl_wizard_cast_e;
ANIMATION_DATA["WIZARD_CAST_E"]=pl_wizard_cast_e;
Animate2D::FrameSequence pl_wizard_cast_n(0.1);
for(int i=0;i<2;i++){
pl_wizard_cast_n.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{7+i,1}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState::WIZARD_CAST_N]=pl_wizard_cast_n;
ANIMATION_DATA["WIZARD_CAST_N"]=pl_wizard_cast_n;
Animate2D::FrameSequence pl_wizard_cast_w(0.1);
for(int i=0;i<2;i++){
pl_wizard_cast_w.AddFrame({&game->GFX_Wizard_Sheet,{vi2d{7+i,2}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState::WIZARD_CAST_W]=pl_wizard_cast_w;
ANIMATION_DATA["WIZARD_CAST_W"]=pl_wizard_cast_w;
//Load slime animations.
for(int slime=0;slime<4;slime++){
std::string colorName="";
switch(slime){
case 0:{
colorName="GREEN";
}break;
case 1:{
colorName="BLUE";
}break;
case 2:{
colorName="RED";
}break;
case 3:{
colorName="YELLOW";
}break;
}
for(int state=0;state<5;state++){
Animate2D::FrameSequence anim;
if(state==4){//These are death animations.
@ -183,92 +199,112 @@ void sig::Animation::InitializeAnimations(){
for (int frame=0;frame<10;frame++){
anim.AddFrame({&game->GFX_Slime_Sheet,{vi2d{frame,state+5*slime}*24,{24,24}}});
}
ANIMATION_DATA[AnimationState(AnimationState::GREEN_SLIME_IDLE+state+slime*5)]=anim;
std::string stateName="";
switch(state){
case 0:{
stateName="IDLE";
}break;
case 1:{
stateName="ROLL";
}break;
case 2:{
stateName="JUMP";
}break;
case 3:{
stateName="SPIT";
}break;
case 4:{
stateName="DIE";
}break;
}
ANIMATION_DATA[colorName+"_SLIME_"+stateName]=anim;
}
}
CreateHorizontalAnimationSequence(game->GFX_Effect_GroundSlam_Back,5,{64,64},AnimationState::GROUND_SLAM_ATTACK_BACK,{0.02,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence(game->GFX_Effect_GroundSlam_Front,5,{64,64},AnimationState::GROUND_SLAM_ATTACK_FRONT,{0.02,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence(game->GFX_Battlecry_Effect,5,{84,84},AnimationState::BATTLECRY_EFFECT,{0.02,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence(game->GFX_SonicSlash,4,{60,60},AnimationState::SONICSLASH,{0.04,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence(game->GFX_Effect_GroundSlam_Back,5,{64,64},"GROUND_SLAM_ATTACK_BACK",{0.02,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence(game->GFX_Effect_GroundSlam_Front,5,{64,64},"GROUND_SLAM_ATTACK_FRONT",{0.02,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence(game->GFX_Battlecry_Effect,5,{84,84},"BATTLECRY_EFFECT",{0.02,Animate2D::Style::OneShot});
CreateHorizontalAnimationSequence(game->GFX_SonicSlash,4,{60,60},"SONICSLASH",{0.04,Animate2D::Style::OneShot});
CreateStillAnimation(game->GFX_EnergyBolt,{24,24},AnimationState::ENERGY_BOLT);
CreateStillAnimation(game->GFX_EnergyBolt,{24,24},"ENERGY_BOLT");
CreateHorizontalAnimationSequence(game->GFX_EnergyParticle,3,{3,3},AnimationState::ENERGY_PARTICLE);
CreateHorizontalAnimationSequence(game->GFX_EnergyParticle,3,{3,3},"ENERGY_PARTICLE");
CreateHorizontalAnimationSequence(game->GFX_Splash_Effect,5,{24,24},AnimationState::SPLASH_EFFECT,{0.05});
CreateHorizontalAnimationSequence(game->GFX_Splash_Effect,5,{24,24},"SPLASH_EFFECT",{0.05});
CreateStillAnimation(game->GFX_BulletCircle,{3,3},AnimationState::DOT_PARTICLE);
CreateStillAnimation(game->GFX_BulletCircle,{3,3},"DOT_PARTICLE");
CreateHorizontalAnimationSequence(game->GFX_LightningBolt,5,{24,24},AnimationState::LIGHTNING_BOLT,{0.03,Animate2D::Style::PingPong});
CreateHorizontalAnimationSequence(game->GFX_LightningBolt,5,{24,24},"LIGHTNING_BOLT",{0.03,Animate2D::Style::PingPong});
CreateStillAnimation(game->GFX_LightningBoltParticle1,{5,5},AnimationState::LIGHTNING_BOLT_PARTICLE1);
CreateStillAnimation(game->GFX_LightningBoltParticle2,{5,5},AnimationState::LIGHTNING_BOLT_PARTICLE2);
CreateStillAnimation(game->GFX_LightningBoltParticle3,{5,5},AnimationState::LIGHTNING_BOLT_PARTICLE3);
CreateStillAnimation(game->GFX_LightningBoltParticle4,{5,5},AnimationState::LIGHTNING_BOLT_PARTICLE4);
CreateStillAnimation(game->GFX_LightningBoltParticle1,{5,5},"LIGHTNING_BOLT_PARTICLE1");
CreateStillAnimation(game->GFX_LightningBoltParticle2,{5,5},"LIGHTNING_BOLT_PARTICLE2");
CreateStillAnimation(game->GFX_LightningBoltParticle3,{5,5},"LIGHTNING_BOLT_PARTICLE3");
CreateStillAnimation(game->GFX_LightningBoltParticle4,{5,5},"LIGHTNING_BOLT_PARTICLE4");
CreateStillAnimation(game->GFX_ChainLightning,{1,9},AnimationState::CHAIN_LIGHTNING);
CreateStillAnimation(game->GFX_ChainLightning,{1,9},"CHAIN_LIGHTNING");
CreateHorizontalAnimationSequence(game->GFX_LightningSplash,5,{24,24},AnimationState::LIGHTNING_SPLASH);
CreateHorizontalAnimationSequence(game->GFX_LightningSplash,5,{24,24},"LIGHTNING_SPLASH");
CreateStillAnimation(game->GFX_Meteor,{192,192},AnimationState::METEOR);
CreateStillAnimation(game->GFX_Meteor,{192,192},"METEOR");
for(int i=0;i<5;i++){
Animate2D::FrameSequence firering;
firering.AddFrame({&game->GFX_LightningSplash,{{i*24,0},{24,24}}});
ANIMATION_DATA[AnimationState(AnimationState::FIRE_RING1+i)]=firering;
ANIMATION_DATA["FIRE_RING"+std::to_string(i+1)]=firering;
}
CreateStillAnimation(game->GFX_Arrow,{24,24},AnimationState::ARROW);
CreateStillAnimation(game->GFX_ChargedArrow,{48,48},AnimationState::CHARGED_ARROW);
CreateStillAnimation(game->GFX_Laser,{5,1},AnimationState::LASER);
CreateStillAnimation(game->GFX_Arrow,{24,24},"ARROW");
CreateStillAnimation(game->GFX_ChargedArrow,{48,48},"CHARGED_ARROW");
CreateStillAnimation(game->GFX_Laser,{5,1},"LASER");
}
void sig::Animation::SetupPlayerAnimations(){
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_WALK_N);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_WALK_E);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_WALK_S);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_WALK_W);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_IDLE_N);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_IDLE_E);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_IDLE_S);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_IDLE_W);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSWORD_E);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSWORD_S);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSWORD_N);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSWORD_W);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_E);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_S);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_N);
game->GetPlayer()->AddAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_W);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_WALK_N);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_WALK_E);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_WALK_S);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_WALK_W);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_IDLE_N);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_IDLE_E);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_IDLE_S);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_IDLE_W);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_SHOOT_S);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_SHOOT_N);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_SHOOT_W);
game->GetPlayer()->AddAnimation(AnimationState::RANGER_SHOOT_E);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_WALK_N);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_WALK_E);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_WALK_S);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_WALK_W);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_N);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_E);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_S);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_W);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_ATTACK_N);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_ATTACK_E);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_ATTACK_S);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_IDLE_ATTACK_W);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_ATTACK_N);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_ATTACK_E);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_ATTACK_S);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_ATTACK_W);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_CAST_N);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_CAST_E);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_CAST_S);
game->GetPlayer()->AddAnimation(AnimationState::WIZARD_CAST_W);
game->GetPlayer()->AddAnimation("WARRIOR_WALK_N");
game->GetPlayer()->AddAnimation("WARRIOR_WALK_E");
game->GetPlayer()->AddAnimation("WARRIOR_WALK_S");
game->GetPlayer()->AddAnimation("WARRIOR_WALK_W");
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_N");
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_E");
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_S");
game->GetPlayer()->AddAnimation("WARRIOR_IDLE_W");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_E");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_S");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_N");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSWORD_W");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_E");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_S");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_N");
game->GetPlayer()->AddAnimation("WARRIOR_SWINGSONICSWORD_W");
game->GetPlayer()->AddAnimation("RANGER_WALK_N");
game->GetPlayer()->AddAnimation("RANGER_WALK_E");
game->GetPlayer()->AddAnimation("RANGER_WALK_S");
game->GetPlayer()->AddAnimation("RANGER_WALK_W");
game->GetPlayer()->AddAnimation("RANGER_IDLE_N");
game->GetPlayer()->AddAnimation("RANGER_IDLE_E");
game->GetPlayer()->AddAnimation("RANGER_IDLE_S");
game->GetPlayer()->AddAnimation("RANGER_IDLE_W");
game->GetPlayer()->AddAnimation("RANGER_SHOOT_S");
game->GetPlayer()->AddAnimation("RANGER_SHOOT_N");
game->GetPlayer()->AddAnimation("RANGER_SHOOT_W");
game->GetPlayer()->AddAnimation("RANGER_SHOOT_E");
game->GetPlayer()->AddAnimation("WIZARD_WALK_N");
game->GetPlayer()->AddAnimation("WIZARD_WALK_E");
game->GetPlayer()->AddAnimation("WIZARD_WALK_S");
game->GetPlayer()->AddAnimation("WIZARD_WALK_W");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_N");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_E");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_S");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_W");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_N");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_E");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_S");
game->GetPlayer()->AddAnimation("WIZARD_IDLE_ATTACK_W");
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_N");
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_E");
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_S");
game->GetPlayer()->AddAnimation("WIZARD_ATTACK_W");
game->GetPlayer()->AddAnimation("WIZARD_CAST_N");
game->GetPlayer()->AddAnimation("WIZARD_CAST_E");
game->GetPlayer()->AddAnimation("WIZARD_CAST_S");
game->GetPlayer()->AddAnimation("WIZARD_CAST_W");
ANIMATION_DATA.SetInitialized();
}

@ -1,32 +1,6 @@
#pragma once
#include "olcUTIL_Animate2D.h"
enum AnimationState{
WARRIOR_WALK_S,WARRIOR_WALK_E,WARRIOR_WALK_N,WARRIOR_WALK_W,
WARRIOR_IDLE_S,WARRIOR_IDLE_E,WARRIOR_IDLE_N,WARRIOR_IDLE_W,
GREEN_SLIME_IDLE,GREEN_SLIME_ROLL,GREEN_SLIME_JUMP,GREEN_SLIME_SPIT,GREEN_SLIME_DIE,
BLUE_SLIME_IDLE,BLUE_SLIME_ROLL,BLUE_SLIME_JUMP,BLUE_SLIME_SPIT,BLUE_SLIME_DIE,
RED_SLIME_IDLE,RED_SLIME_ROLL,RED_SLIME_JUMP,RED_SLIME_SPIT,RED_SLIME_DIE,
YELLOW_SLIME_IDLE,YELLOW_SLIME_ROLL,YELLOW_SLIME_JUMP,YELLOW_SLIME_SPIT,YELLOW_SLIME_DIE,
GROUND_SLAM_ATTACK_BACK,GROUND_SLAM_ATTACK_FRONT,
WARRIOR_SWINGSWORD_S,WARRIOR_SWINGSWORD_E,WARRIOR_SWINGSWORD_N,WARRIOR_SWINGSWORD_W,
RANGER_WALK_S,RANGER_WALK_E,RANGER_WALK_N,RANGER_WALK_W,
RANGER_IDLE_S,RANGER_IDLE_E,RANGER_IDLE_N,RANGER_IDLE_W,
WIZARD_WALK_S,WIZARD_WALK_E,WIZARD_WALK_N,WIZARD_WALK_W,
WIZARD_IDLE_S,WIZARD_IDLE_E,WIZARD_IDLE_N,WIZARD_IDLE_W,
BATTLECRY_EFFECT,SONICSLASH,
WARRIOR_SWINGSONICSWORD_S,WARRIOR_SWINGSONICSWORD_E,WARRIOR_SWINGSONICSWORD_N,WARRIOR_SWINGSONICSWORD_W,
WIZARD_IDLE_ATTACK_S,WIZARD_IDLE_ATTACK_E,WIZARD_IDLE_ATTACK_N,WIZARD_IDLE_ATTACK_W,
WIZARD_ATTACK_S,WIZARD_ATTACK_E,WIZARD_ATTACK_N,WIZARD_ATTACK_W,
ENERGY_BOLT,ENERGY_PARTICLE,SPLASH_EFFECT,DOT_PARTICLE,
LIGHTNING_BOLT,LIGHTNING_BOLT_PARTICLE1,LIGHTNING_BOLT_PARTICLE2,LIGHTNING_BOLT_PARTICLE3,LIGHTNING_BOLT_PARTICLE4,
CHAIN_LIGHTNING,LIGHTNING_SPLASH,
WIZARD_CAST_S,WIZARD_CAST_N,WIZARD_CAST_E,WIZARD_CAST_W,METEOR,
FIRE_RING1,FIRE_RING2,FIRE_RING3,FIRE_RING4,FIRE_RING5,ARROW,
RANGER_SHOOT_S,RANGER_SHOOT_N,RANGER_SHOOT_E,RANGER_SHOOT_W,
LASER,CHARGED_ARROW
};
namespace sig{
class Animation{
public:

@ -10,7 +10,7 @@ INCLUDE_game
Arrow::Arrow(vf2d pos,vf2d targetPos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
:finalDistance(geom2d::line(pos,targetPos).length()),acc(PI/2*"Ranger.Auto Attack.ArrowSpd"_F),
Bullet(pos,vel,radius,damage,
AnimationState::ARROW,upperLevel,false,INFINITE,true,friendly,col){}
"ARROW",upperLevel,false,INFINITE,true,friendly,col){}
void Arrow::Update(float fElapsedTime){
float speed=vel.mag();
@ -26,7 +26,7 @@ bool Arrow::PlayerHit(Player*player)
{
deactivated=true;
fadeOutTime=0.2f;
game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,player->GetSizeMult(),0.25));
game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,"SPLASH_EFFECT",upperLevel,player->GetSizeMult(),0.25));
return false;
}
@ -34,6 +34,6 @@ bool Arrow::MonsterHit(Monster& monster)
{
deactivated=true;
fadeOutTime=0.2f;
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,monster.GetSizeMult(),0.25));
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,"SPLASH_EFFECT",upperLevel,monster.GetSizeMult(),0.25));
return false;
}

@ -1,6 +1,7 @@
#include "Bullet.h"
#include "Crawler.h"
#include "DEFINES.h"
#include "safemap.h"
INCLUDE_ANIMATION_DATA
INCLUDE_game
@ -8,7 +9,7 @@ INCLUDE_game
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col,vf2d scale)
:pos(pos),vel(vel),radius(radius),damage(damage),col(col),friendly(friendly),upperLevel(upperLevel),scale(scale){};
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,AnimationState animation,bool upperLevel,bool hitsMultiple,float lifetime,bool rotatesWithAngle,bool friendly,Pixel col,vf2d scale)
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,std::string animation,bool upperLevel,bool hitsMultiple,float lifetime,bool rotatesWithAngle,bool friendly,Pixel col,vf2d scale)
:pos(pos),vel(vel),radius(radius),damage(damage),col(col),animated(true),rotates(rotatesWithAngle),lifetime(lifetime),hitsMultiple(hitsMultiple),friendly(friendly),upperLevel(upperLevel),scale(scale){
this->animation.AddState(animation,ANIMATION_DATA[animation]);
this->animation.ChangeState(internal_animState,animation);

@ -26,13 +26,13 @@ private:
void UpdateFadeTime(float fElapsedTime);
vf2d scale={1,1};
public:
Animate2D::Animation<AnimationState>animation;
Animate2D::Animation<std::string>animation;
Animate2D::AnimationState internal_animState;
std::map<Monster*,bool>hitList;
virtual ~Bullet()=default;
Bullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1});
//Initializes a bullet with an animation.
Bullet(vf2d pos,vf2d vel,float radius,int damage,AnimationState animation,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool rotatesWithAngle=false,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1});
Bullet(vf2d pos,vf2d vel,float radius,int damage,std::string animation,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool rotatesWithAngle=false,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1});
public:
virtual void Update(float fElapsedTime);
//Return true when the bullet should be destroyed. Return false to handle it otherwise (like deactivating it instead). You become responsible for getting rid of the bullet.

@ -10,14 +10,14 @@ INCLUDE_game
ChargedArrow::ChargedArrow(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
:lastLaserPos(pos),
Bullet(pos,vel,radius,damage,
AnimationState::CHARGED_ARROW,upperLevel,true,INFINITE,true,friendly,col){}
"CHARGED_ARROW",upperLevel,true,INFINITE,true,friendly,col){}
void ChargedArrow::Update(float fElapsedTime){
geom2d::line lineToCurrentPos(geom2d::line(lastLaserPos,pos));
float dist=lineToCurrentPos.length();
if(dist>=1){
vf2d midpoint(lineToCurrentPos.rpoint(0.5));
game->AddEffect(std::make_unique<Effect>(midpoint,0.1,AnimationState::LASER,upperLevel,vf2d{1,dist},0.3,vf2d{},Pixel{192,128,238},atan2(pos.y-lastLaserPos.y,pos.x-lastLaserPos.x)+PI/2,0,true));
game->AddEffect(std::make_unique<Effect>(midpoint,0.1,"LASER",upperLevel,vf2d{1,dist},0.3,vf2d{},Pixel{192,128,238},atan2(pos.y-lastLaserPos.y,pos.x-lastLaserPos.x)+PI/2,0,true));
lastLaserPos=pos;
}
}

@ -15,12 +15,13 @@
#include <queue>
#include "Emitter.h"
#include "config.h"
#include "safemap.h"
INCLUDE_EMITTER_LIST
//192x192
vi2d WINDOW_SIZE={24*15,24*10};
std::map<AnimationState,Animate2D::FrameSequence>ANIMATION_DATA;
safemap<std::string,Animate2D::FrameSequence>ANIMATION_DATA;
std::vector<Monster>MONSTER_LIST;
std::vector<MonsterSpawner>SPAWNER_LIST;
std::vector<std::shared_ptr<DamageNumber>>DAMAGENUMBER_LIST;
@ -52,6 +53,12 @@ Crawler::Crawler()
std::string PLAYER_CONFIG = CONFIG_PATH + "player_config"_S;
utils::datafile::Read(DATA,PLAYER_CONFIG);
std::string MONSTERS_CONFIG = CONFIG_PATH + "monsters_config"_S;
utils::datafile::Read(DATA,MONSTERS_CONFIG);
std::string MONSTERSTRATEGIES_CONFIG = CONFIG_PATH + "monsterstrategies_config"_S;
utils::datafile::Read(DATA,MONSTERSTRATEGIES_CONFIG);
for(std::string&cl:DATA.GetProperty("class_list").GetValues()){
std::cout<<cl<<std::endl;
utils::datafile::Read(DATA,CONFIG_PATH + "class_directory"_S + cl + ".txt");
@ -115,8 +122,10 @@ bool Crawler::OnUserCreate(){
LOADIMG(GFX_Laser)
LOADIMG(GFX_ChargedArrow)
Monster::InitializeStrategies();
//Animations
sig::Animation::InitializeAnimations();
MonsterData::InitializeMonsterData();
sig::Animation::SetupPlayerAnimations();
view=TileTransformedView{GetScreenSize(),{1,1}};

@ -282,6 +282,7 @@
<ClInclude Include="Player.h" />
<ClInclude Include="resource.h" />
<ClInclude Include="resource1.h" />
<ClInclude Include="safemap.h" />
<ClInclude Include="State.h" />
<ClInclude Include="TMXParser.h" />
<ClInclude Include="TSXParser.h" />
@ -331,6 +332,8 @@
<Text Include="assets\config\configuration.txt" />
<Text Include="assets\config\gfx\gfx.txt" />
<Text Include="assets\config\levels.txt" />
<Text Include="assets\config\Monsters.txt" />
<Text Include="assets\config\MonsterStrategies.txt" />
<Text Include="assets\config\Player.txt" />
<Text Include="NewClasses.txt" />
<Text Include="InitialConcept.txt" />

@ -126,6 +126,9 @@
<ClInclude Include="config.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="safemap.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">
@ -254,6 +257,12 @@
<Text Include="assets\config\Player.txt">
<Filter>Configurations</Filter>
</Text>
<Text Include="assets\config\Monsters.txt">
<Filter>Configurations</Filter>
</Text>
<Text Include="assets\config\MonsterStrategies.txt">
<Filter>Configurations</Filter>
</Text>
</ItemGroup>
<ItemGroup>
<Image Include="assets\heart.ico">

@ -1,5 +1,5 @@
#pragma once
#define INCLUDE_ANIMATION_DATA extern std::map<AnimationState,Animate2D::FrameSequence>ANIMATION_DATA;
#define INCLUDE_ANIMATION_DATA extern safemap<std::string,Animate2D::FrameSequence>ANIMATION_DATA;
#define INCLUDE_MONSTER_LIST extern std::vector<Monster>MONSTER_LIST;
#define INCLUDE_SPAWNER_LIST extern std::vector<MonsterSpawner>SPAWNER_LIST;
#define INCLUDE_DAMAGENUMBER_LIST extern std::vector<std::shared_ptr<DamageNumber>>DAMAGENUMBER_LIST;
@ -8,6 +8,8 @@
#define INCLUDE_BULLET_LIST extern std::vector<std::unique_ptr<Bullet>>BULLET_LIST;
#define INCLUDE_PARTICLE_LIST extern std::vector<Particle>PARTICLE_LIST;
#define INCLUDE_EMITTER_LIST extern std::vector<std::unique_ptr<Emitter>>EMITTER_LIST;
#define INCLUDE_DATA extern utils::datafile DATA;
#define INCLUDE_STRATEGY_DATA extern safemap<std::string,MonsterStrategy>STRATEGY_DATA;
#define ACCESS_PLAYER Player*p=game->GetPlayer();
@ -25,14 +27,14 @@ Ability&class::GetAbility1(){return ability1;}; \
Ability&class::GetAbility2(){return ability2;}; \
Ability&class::GetAbility3(){return ability3;}; \
Ability&class::GetAbility4(){return ability4;}; \
AnimationState&class::GetWalkNAnimation(){return walk_n;}; \
AnimationState&class::GetWalkEAnimation(){return walk_e;}; \
AnimationState&class::GetWalkSAnimation(){return walk_s;}; \
AnimationState&class::GetWalkWAnimation(){return walk_w;}; \
AnimationState&class::GetIdleNAnimation(){return idle_n;}; \
AnimationState&class::GetIdleEAnimation(){return idle_e;}; \
AnimationState&class::GetIdleSAnimation(){return idle_s;}; \
AnimationState&class::GetIdleWAnimation(){return idle_w;}; \
std::string&class::GetWalkNAnimation(){return walk_n;}; \
std::string&class::GetWalkEAnimation(){return walk_e;}; \
std::string&class::GetWalkSAnimation(){return walk_s;}; \
std::string&class::GetWalkWAnimation(){return walk_w;}; \
std::string&class::GetIdleNAnimation(){return idle_n;}; \
std::string&class::GetIdleEAnimation(){return idle_e;}; \
std::string&class::GetIdleSAnimation(){return idle_s;}; \
std::string&class::GetIdleWAnimation(){return idle_w;}; \
std::string class::name=""; \
Class class::cl=ANY; \
Ability class::rightClickAbility=Ability("",0,0); \
@ -40,11 +42,11 @@ Ability class::ability1=Ability("",0,0); \
Ability class::ability2=Ability("",0,0); \
Ability class::ability3=Ability("",0,0); \
Ability class::ability4=Ability("",0,0); \
AnimationState class::idle_n=WARRIOR_IDLE_N; \
AnimationState class::idle_e=WARRIOR_IDLE_E; \
AnimationState class::idle_s=WARRIOR_IDLE_S; \
AnimationState class::idle_w=WARRIOR_IDLE_W; \
AnimationState class::walk_n=WARRIOR_WALK_N; \
AnimationState class::walk_e=WARRIOR_WALK_E; \
AnimationState class::walk_s=WARRIOR_WALK_S; \
AnimationState class::walk_w=WARRIOR_WALK_W;
std::string class::idle_n="WARRIOR_IDLE_N"; \
std::string class::idle_e="WARRIOR_IDLE_E"; \
std::string class::idle_s="WARRIOR_IDLE_S"; \
std::string class::idle_w="WARRIOR_IDLE_W"; \
std::string class::walk_n="WARRIOR_WALK_N"; \
std::string class::walk_e="WARRIOR_WALK_E"; \
std::string class::walk_s="WARRIOR_WALK_S"; \
std::string class::walk_w="WARRIOR_WALK_W";

@ -1,16 +1,17 @@
#include "DEFINES.h"
#include "Effect.h"
#include "Crawler.h"
#include "safemap.h"
INCLUDE_ANIMATION_DATA
INCLUDE_game
Effect::Effect(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
Effect::Effect(vf2d pos,float lifetime,std::string animation,bool upperLevel,float size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:Effect::Effect(pos,lifetime,animation,upperLevel,vf2d{size,size},fadeout,spd,col,rotation,rotationSpd,additiveBlending){
this->animation.AddState(animation,ANIMATION_DATA[animation]);
}
Effect::Effect(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,vf2d size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
Effect::Effect(vf2d pos,float lifetime,std::string animation,bool upperLevel,vf2d size,float fadeout,vf2d spd,Pixel col,float rotation,float rotationSpd,bool additiveBlending)
:pos(pos),lifetime(lifetime),upperLevel(upperLevel),size(size),fadeout(fadeout),original_fadeoutTime(fadeout),spd(spd),col(col),rotation(rotation),rotationSpd(rotationSpd),additiveBlending(additiveBlending){
this->animation.AddState(animation,ANIMATION_DATA[animation]);
}

@ -13,8 +13,8 @@ struct Effect{
float rotation=0;
float rotationSpd=0;
bool additiveBlending=false;
Effect(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,float size=1.0f,float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
Effect(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
Effect(vf2d pos,float lifetime,std::string animation,bool upperLevel,float size=1.0f,float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
Effect(vf2d pos,float lifetime,std::string animation,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
virtual bool Update(float fElapsedTime);
Animate2D::Frame GetFrame();
virtual void Draw();
@ -22,13 +22,13 @@ struct Effect{
protected:
float original_fadeoutTime;
private:
Animate2D::Animation<AnimationState>animation;
Animate2D::Animation<std::string>animation;
Animate2D::AnimationState internal_animState;
bool upperLevel=false;
};
struct Meteor:Effect{
Meteor(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
Meteor(vf2d pos,float lifetime,std::string animation,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
float startLifetime=0;
bool shakeField=false;
bool Update(float fElapsedTime)override;
@ -36,7 +36,7 @@ struct Meteor:Effect{
};
struct PulsatingFire:Effect{
PulsatingFire(vf2d pos,float lifetime,AnimationState animation,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
PulsatingFire(vf2d pos,float lifetime,std::string animation,bool upperLevel,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false);
std::vector<float>pulsatingFireValues;
float lastParticleTimer=0;
float lastDamageTimer=0;

@ -8,13 +8,13 @@ INCLUDE_game
EnergyBolt::EnergyBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
:Bullet(pos,vel,radius,damage,
AnimationState::ENERGY_BOLT,upperLevel,false,INFINITE,true,friendly,col){}
"ENERGY_BOLT",upperLevel,false,INFINITE,true,friendly,col){}
void EnergyBolt::Update(float fElapsedTime){
lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime);
if(lastParticleSpawn==0){
lastParticleSpawn="Wizard.Auto Attack.ParticleFrequency"_F;
game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Auto Attack.ParticleLifetimeRange"_FRange,AnimationState::ENERGY_PARTICLE,upperLevel,"Wizard.Auto Attack.ParticleSizeRange"_FRange,"Wizard.Auto Attack.ParticleFadeoutTime"_F,vf2d{"Wizard.Auto Attack.ParticleSpeedRange"_FRange,"Wizard.Auto Attack.ParticleSpeedRange"_FRange}));
game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Auto Attack.ParticleLifetimeRange"_FRange,"ENERGY_PARTICLE",upperLevel,"Wizard.Auto Attack.ParticleSizeRange"_FRange,"Wizard.Auto Attack.ParticleFadeoutTime"_F,vf2d{"Wizard.Auto Attack.ParticleSpeedRange"_FRange,"Wizard.Auto Attack.ParticleSpeedRange"_FRange}));
}
}
@ -22,7 +22,7 @@ bool EnergyBolt::PlayerHit(Player*player)
{
deactivated=true;
fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F;
game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,player->GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F));
game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,"SPLASH_EFFECT",upperLevel,player->GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F));
return false;
}
@ -30,6 +30,6 @@ bool EnergyBolt::MonsterHit(Monster& monster)
{
deactivated=true;
fadeOutTime="Wizard.Auto Attack.BulletHitFadeoutTime"_F;
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,monster.GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F));
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,"SPLASH_EFFECT",upperLevel,monster.GetSizeMult(),"Wizard.Auto Attack.SplashEffectFadeoutTime"_F));
return false;
}

@ -9,13 +9,13 @@ INCLUDE_MONSTER_LIST
FireBolt::FireBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
:Bullet(pos,vel,radius,damage,
AnimationState::ENERGY_BOLT,upperLevel,false,INFINITE,true,friendly,col){}
"ENERGY_BOLT",upperLevel,false,INFINITE,true,friendly,col){}
void FireBolt::Update(float fElapsedTime){
lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime);
if(lastParticleSpawn==0){
lastParticleSpawn="Wizard.Ability 1.ParticleFrequency"_F;
game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Ability 1.ParticleLifetimeRange"_FRange,AnimationState::ENERGY_PARTICLE,upperLevel,"Wizard.Ability 1.ParticleSizeRange"_FRange,"Wizard.Ability 1.ParticleFadeoutTime"_F,vf2d{"Wizard.Ability 1.ParticleXSpeedRange"_FRange,"Wizard.Ability 1.ParticleYSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.ParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.ParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.ParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.ParticleAlphaRange"_FRange)}));
game->AddEffect(std::make_unique<Effect>(pos,"Wizard.Ability 1.ParticleLifetimeRange"_FRange,"ENERGY_PARTICLE",upperLevel,"Wizard.Ability 1.ParticleSizeRange"_FRange,"Wizard.Ability 1.ParticleFadeoutTime"_F,vf2d{"Wizard.Ability 1.ParticleXSpeedRange"_FRange,"Wizard.Ability 1.ParticleYSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.ParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.ParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.ParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.ParticleAlphaRange"_FRange)}));
}
}
@ -23,7 +23,7 @@ bool FireBolt::PlayerHit(Player*player)
{
deactivated=true;
fadeOutTime="Wizard.Ability 1.BulletHitFadeoutTime"_F;
game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,5,0.25,vf2d{},Pixel{240,120,60}));
game->AddEffect(std::make_unique<Effect>(player->GetPos(),0,"SPLASH_EFFECT",upperLevel,5,0.25,vf2d{},Pixel{240,120,60}));
return false;
}
@ -32,10 +32,10 @@ bool FireBolt::MonsterHit(Monster& monster)
deactivated=true;
fadeOutTime="Wizard.Ability 1.BulletHitFadeoutTime"_F;
for(int i=0;i<"Wizard.Ability 1.BulletHitExplosionParticleCount"_I;i++){
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,AnimationState::DOT_PARTICLE,upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}));
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionParticleLifetimeRange"_FRange,"DOT_PARTICLE",upperLevel,"Wizard.Ability 1.BulletHitExplosionParticleSizeRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange,"Wizard.Ability 1.BulletHitExplosionParticleSpeedRange"_FRange},Pixel{uint8_t("Wizard.Ability 1.BulletHitExplosionParticleRedRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleGreenRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleBlueRange"_FRange),uint8_t("Wizard.Ability 1.BulletHitExplosionParticleAlphaRange"_FRange)}));
}
game->SetupWorldShake("Wizard.Ability 1.WorldShakeTime"_F);
game->HurtEnemies(monster.GetPos(),"Wizard.Ability 1.BulletHitExplosionRange"_F/100*12,"Wizard.Ability 1.BulletHitExplosionDamageMult"_F*game->GetPlayer()->GetAttack(),OnUpperLevel());
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,AnimationState::SPLASH_EFFECT,upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel));
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),0,"SPLASH_EFFECT",upperLevel,"Wizard.Ability 1.BulletHitExplosionRange"_F/100*2,"Wizard.Ability 1.BulletHitExplosionFadeoutTime"_F,vf2d{},"Wizard.Ability 1.BulletHitExplosionColor"_Pixel));
return false;
}

@ -11,7 +11,7 @@ INCLUDE_EMITTER_LIST
LightningBolt::LightningBolt(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
:Bullet(pos,vel,radius,damage,
AnimationState::LIGHTNING_BOLT,upperLevel,false,INFINITE,true,friendly,col){}
"LIGHTNING_BOLT",upperLevel,false,INFINITE,true,friendly,col){}
void LightningBolt::Update(float fElapsedTime){
lastParticleSpawn=std::max(0.f,lastParticleSpawn-fElapsedTime);
@ -21,16 +21,16 @@ void LightningBolt::Update(float fElapsedTime){
uint8_t brightness=uint8_t("Wizard.Ability 2.ParticleColorRange"_FRange);
switch(rand()%4){
case 0:{
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,AnimationState::LIGHTNING_BOLT_PARTICLE1,upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"LIGHTNING_BOLT_PARTICLE1",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
}break;
case 1:{
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,AnimationState::LIGHTNING_BOLT_PARTICLE2,upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"LIGHTNING_BOLT_PARTICLE2",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
}break;
case 2:{
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,AnimationState::LIGHTNING_BOLT_PARTICLE3,upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"LIGHTNING_BOLT_PARTICLE3",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
}break;
case 3:{
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,AnimationState::LIGHTNING_BOLT_PARTICLE4,upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
game->AddEffect(std::make_unique<Effect>(pos+vf2d{"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange,"Wizard.Ability 2.ParticleSpawnRadiusRange"_FRange},"Wizard.Ability 2.ParticleLifetimeRange"_FRange,"LIGHTNING_BOLT_PARTICLE4",upperLevel,"Wizard.Ability 2.ParticleSizeRange"_FRange,"Wizard.Ability 2.ParticleFadeoutTime"_F,vel*"Wizard.Ability 2.ParticleSpeedMultRange"_FRange,Pixel{brightness,brightness,brightness}));
}break;
}
}
@ -40,7 +40,7 @@ bool LightningBolt::PlayerHit(Player*player)
{
deactivated=true;
fadeOutTime="Wizard.Ability 2.BulletFadeoutTime"_F;
game->AddEffect(std::make_unique<Effect>(player->GetPos(),"Wizard.Ability 2.SplashLifetime"_F,AnimationState::LIGHTNING_SPLASH,upperLevel,player->GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange));
game->AddEffect(std::make_unique<Effect>(player->GetPos(),"Wizard.Ability 2.SplashLifetime"_F,"LIGHTNING_SPLASH",upperLevel,player->GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange));
return false;
}
@ -48,7 +48,7 @@ bool LightningBolt::MonsterHit(Monster& monster)
{
deactivated=true;
fadeOutTime="Wizard.Ability 2.BulletFadeoutTime"_F;
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),"Wizard.Ability 2.SplashLifetime"_F,AnimationState::LIGHTNING_SPLASH,upperLevel,monster.GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange));
game->AddEffect(std::make_unique<Effect>(monster.GetPos(),"Wizard.Ability 2.SplashLifetime"_F,"LIGHTNING_SPLASH",upperLevel,monster.GetSizeMult(),"Wizard.Ability 2.SplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.SplashRotationRange"_FRange));
int targetsHit=0;
for(Monster&m:MONSTER_LIST){
if(&m==&monster||monster.OnUpperLevel()!=m.OnUpperLevel())continue;
@ -57,7 +57,7 @@ bool LightningBolt::MonsterHit(Monster& monster)
if(dist<="Wizard.Ability 2.LightningChainRadius"_F/100*24){
if(m.Hurt(game->GetPlayer()->GetAttack()*"Wizard.Ability 2.LightningChainDamageMult"_F,OnUpperLevel())){
EMITTER_LIST.push_back(std::make_unique<LightningBoltEmitter>(LightningBoltEmitter(monster.GetPos(),m.GetPos(),"Wizard.Ability 2.LightningChainFrequency"_F,"Wizard.Ability 2.LightningChainLifetime"_F,upperLevel)));
game->AddEffect(std::make_unique<Effect>(m.GetPos(),"Wizard.Ability 2.LightningChainSplashLifetime"_F,AnimationState::LIGHTNING_SPLASH,upperLevel,monster.GetSizeMult(),"Wizard.Ability 2.LightningChainSplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.LightningChainSplashRotationRange"_FRange));
game->AddEffect(std::make_unique<Effect>(m.GetPos(),"Wizard.Ability 2.LightningChainSplashLifetime"_F,"LIGHTNING_SPLASH",upperLevel,monster.GetSizeMult(),"Wizard.Ability 2.LightningChainSplashFadeoutTime"_F,vf2d{},WHITE,"Wizard.Ability 2.LightningChainSplashRotationRange"_FRange));
targetsHit++;
}
}

@ -22,7 +22,7 @@ void LightningBoltEmitter::DrawLightningBolt(){
float targetDist=lineToTarget.length()*util::random(0.5);
targetAngle+=util::random((PI/2))-PI/4;
geom2d::line<float>lightningLine=geom2d::line<float>(currentPos,currentPos+vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist});
game->AddEffect(std::make_unique<Effect>(lightningLine.upoint(0),0,AnimationState::CHAIN_LIGHTNING,upperLevel,vf2d{lightningLine.length(),0.2},0.2,vf2d{},WHITE,targetAngle,0,true));
game->AddEffect(std::make_unique<Effect>(lightningLine.upoint(0),0,"CHAIN_LIGHTNING",upperLevel,vf2d{lightningLine.length(),0.2},0.2,vf2d{},WHITE,targetAngle,0,true));
int iterations=1;
currentPos+=vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist};
while(iterations<MAX_ITERATIONS&&geom2d::line<float>(currentPos,endPos).length()>1){
@ -31,7 +31,7 @@ void LightningBoltEmitter::DrawLightningBolt(){
float targetDist=lineToTarget.length()*util::random(0.5);
targetAngle+=util::random((PI/2))-PI/4;
geom2d::line<float>lightningLine=geom2d::line<float>(currentPos,currentPos+vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist});
game->AddEffect(std::make_unique<Effect>(lightningLine.upoint(0),0,AnimationState::CHAIN_LIGHTNING,upperLevel,vf2d{lightningLine.length(),0.2},0.2,vf2d{},WHITE,targetAngle,0,true));
game->AddEffect(std::make_unique<Effect>(lightningLine.upoint(0),0,"CHAIN_LIGHTNING",upperLevel,vf2d{lightningLine.length(),0.2},0.2,vf2d{},WHITE,targetAngle,0,true));
currentPos+=vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist};
iterations++;
}

@ -6,7 +6,7 @@
INCLUDE_game
INCLUDE_MONSTER_LIST
Meteor::Meteor(vf2d pos, float lifetime, AnimationState animation, bool upperLevel, vf2d size, float fadeout, vf2d spd, Pixel col, float rotation, float rotationSpd, bool additiveBlending)
Meteor::Meteor(vf2d pos, float lifetime, std::string animation, bool upperLevel, vf2d size, float fadeout, vf2d spd, Pixel col, float rotation, float rotationSpd, bool additiveBlending)
:Effect(pos,lifetime,animation,upperLevel,size,fadeout,spd,col,rotation,rotationSpd,additiveBlending),startLifetime(lifetime){
}
@ -22,10 +22,10 @@ bool Meteor::Update(float fElapsedTime){
float randomColorTintG=256*(1-util::random("Wizard.Ability 3.MeteorImpactParticleColorGVariance"_F))*(1-util::random("Wizard.Ability 3.MeteorImpactParticleColorGVariance"_F));
float randomColorTintB="Wizard.Ability 3.MeteorImpactParticleColorBlueRange"_FRange;
vf2d effectPos=vf2d{cos(randomAngle),sin(randomAngle)}*randomRange+meteorOffset;
game->AddEffect(std::make_unique<Effect>(effectPos,0,AnimationState::DOT_PARTICLE,OnUpperLevel(),vf2d{util::random(2)+1,util::random(3)+1},util::random(3)+1,vf2d{util::random(10)-5,-util::random(20)-5},Pixel{255,uint8_t(randomColorTintG),uint8_t(randomColorTintB),uint8_t("Wizard.Ability 3.MeteorImpactParticleAlphaRange"_FRange)},0,0,true),effectPos.y<meteorOffset.y);
game->AddEffect(std::make_unique<Effect>(effectPos,0,"DOT_PARTICLE",OnUpperLevel(),vf2d{util::random(2)+1,util::random(3)+1},util::random(3)+1,vf2d{util::random(10)-5,-util::random(20)-5},Pixel{255,uint8_t(randomColorTintG),uint8_t(randomColorTintB),uint8_t("Wizard.Ability 3.MeteorImpactParticleAlphaRange"_FRange)},0,0,true),effectPos.y<meteorOffset.y);
}
game->HurtEnemies(pos,"Wizard.Ability 3.MeteorRadius"_F/100*24,game->GetPlayer()->GetAttack()*"Wizard.Ability 3.MeteorDamageMult"_F,OnUpperLevel());
game->AddEffect(std::make_unique<PulsatingFire>(pos,"Wizard.Ability 3.FireRingLifetime"_F,AnimationState::FIRE_RING1,OnUpperLevel(),vf2d{"Wizard.Ability 3.MeteorRadius"_F/100*2,"Wizard.Ability 3.MeteorRadius"_F/100*2},"Wizard.Ability 3.FireRingFadeoutTime"_F),true);
game->AddEffect(std::make_unique<PulsatingFire>(pos,"Wizard.Ability 3.FireRingLifetime"_F,"FIRE_RING1",OnUpperLevel(),vf2d{"Wizard.Ability 3.MeteorRadius"_F/100*2,"Wizard.Ability 3.MeteorRadius"_F/100*2},"Wizard.Ability 3.FireRingFadeoutTime"_F),true);
}
return Effect::Update(fElapsedTime);
}

@ -4,6 +4,7 @@
#include "Bullet.h"
#include "BulletTypes.h"
#include "DEFINES.h"
#include "safemap.h"
INCLUDE_ANIMATION_DATA
INCLUDE_MONSTER_DATA
@ -11,11 +12,15 @@ INCLUDE_MONSTER_LIST
INCLUDE_DAMAGENUMBER_LIST
INCLUDE_game
INCLUDE_BULLET_LIST
INCLUDE_DATA
INCLUDE_STRATEGY_DATA
safemap<std::string,MonsterStrategy>STRATEGY_DATA;
Monster::Monster(vf2d pos,MonsterData data,bool upperLevel):
pos(pos),hp(data.GetHealth()),maxhp(data.GetHealth()),atk(data.GetAttack()),moveSpd(data.GetMoveSpdMult()),size(data.GetSizeMult()),strategy(data.GetAIStrategy()),type(data.GetType()),upperLevel(upperLevel){
bool firstAnimation=true;
for(AnimationState&anim:data.GetAnimations()){
for(std::string&anim:data.GetAnimations()){
animation.AddState(anim,ANIMATION_DATA[anim]);
if(firstAnimation){
animation.ChangeState(internal_animState,anim);
@ -50,7 +55,7 @@ float Monster::GetSizeMult(){
Animate2D::Frame Monster::GetFrame(){
return animation.GetFrame(internal_animState);
}
void Monster::UpdateAnimation(AnimationState state){
void Monster::UpdateAnimation(std::string state){
animation.ChangeState(internal_animState,state);
}
void Monster::PerformJumpAnimation(){
@ -325,7 +330,7 @@ void Monster::Moved(){
}
}
}
AnimationState Monster::GetDeathAnimationName(){
std::string Monster::GetDeathAnimationName(){
return MONSTER_DATA[type].GetDeathAnimation();
}
bool Monster::Hurt(int damage,bool onUpperLevel){
@ -438,4 +443,13 @@ State Monster::GetState(){
void Monster::SetState(State newState){
state=newState;
}
void Monster::InitializeStrategies(){
int readCounter=0;
while(DATA["MonsterStrategy"].HasProperty(std::to_string(readCounter))){
STRATEGY_DATA[DATA["MonsterStrategy"][std::to_string(readCounter)]["Name"].GetString()]=MonsterStrategy(readCounter);
readCounter++;
}
STRATEGY_DATA.SetInitialized();
}

@ -9,8 +9,12 @@
struct Player;
enum MonsterStrategy{
/// <summary>
/// NOTE: When adding a new strategy, update MonsterStrategies.txt!!
/// </summary>
RUN_TOWARDS,
SHOOT_AFAR
SHOOT_AFAR,
TURRET
};
enum MonsterName{
@ -18,6 +22,7 @@ enum MonsterName{
SLIME_BLUE,
SLIME_RED,
SLIME_YELLOW,
FLOWER_TURRET,
///////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -31,17 +36,17 @@ struct MonsterData{
int atk;
float moveSpd;//1.0=100%
float size;
std::vector<AnimationState> animations;
std::vector<std::string> animations;
MonsterStrategy strategy;
MonsterName type;
int collisionDmg;
AnimationState jumpAnimation=AnimationState::WARRIOR_IDLE_S;
AnimationState shootAnimation=AnimationState::WARRIOR_IDLE_S;
AnimationState deathAnimation=AnimationState::WARRIOR_IDLE_S;
std::string jumpAnimation="WARRIOR_IDLE_S";
std::string shootAnimation="WARRIOR_IDLE_S";
std::string deathAnimation="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::vector<AnimationState>animations,AnimationState jumpAnimation,AnimationState shootAnimation,AnimationState deathAnimation,float moveSpd=1.0f,float size=1.0f,MonsterStrategy strategy=RUN_TOWARDS,int collisionDmg=0);
MonsterData(MonsterName type,int hp,int atk,std::vector<std::string>animations,std::string jumpAnimation,std::string shootAnimation,std::string deathAnimation,float moveSpd=1.0f,float size=1.0f,MonsterStrategy strategy=RUN_TOWARDS,int collisionDmg=0);
int GetHealth();
int GetAttack();
float GetMoveSpdMult();
@ -49,12 +54,13 @@ struct MonsterData{
MonsterName GetType();
MonsterStrategy GetAIStrategy();
int GetCollisionDmg();
AnimationState GetJumpAnimation();
AnimationState GetShootAnimation();
AnimationState GetDeathAnimation();
std::vector<AnimationState>GetAnimations(){
std::string GetJumpAnimation();
std::string GetShootAnimation();
std::string GetDeathAnimation();
std::vector<std::string>GetAnimations(){
return animations;
}
static void InitializeMonsterData();
};
struct Monster{
@ -73,13 +79,13 @@ struct Monster{
Key facingDirection;
MonsterStrategy strategy;
State state=State::NORMAL;
Animate2D::Animation<AnimationState>animation;
Animate2D::Animation<std::string>animation;
Animate2D::AnimationState internal_animState;
float randomFrameOffset=0.f;
float deathTimer=0.f;
MonsterName type;
std::vector<Buff>buffList;
AnimationState GetDeathAnimationName();
std::string GetDeathAnimationName();
bool hasHitPlayer=false;
bool canMove=true; //Set to false when stuck due to collisions.
bool upperLevel=false;
@ -89,7 +95,7 @@ struct Monster{
float lastHitTimer=0;
std::shared_ptr<DamageNumber>damageNumberPtr;
protected:
public:
public:
Monster()=delete;
Monster(vf2d pos,MonsterData data,bool upperLevel=false);
vf2d&GetPos();
@ -98,7 +104,7 @@ protected:
float GetMoveSpdMult();
float GetSizeMult();
Animate2D::Frame GetFrame();
void UpdateAnimation(AnimationState state);
void UpdateAnimation(std::string state);
bool Update(float fElapsedTime);
//Returns true when damage is actually dealt. Provide whether or not the attack is on the upper level or not. Monsters must be on the same level to get hit by it. (there is a death check and level check here.)
//If you need to hurt multiple enemies try Crawler::HurtEnemies()
@ -127,6 +133,7 @@ protected:
std::vector<Buff>GetBuffs(BuffType buff);
State GetState();
void SetState(State newState);
static void InitializeStrategies();
};
struct MonsterSpawner{

@ -1,27 +1,55 @@
#include "olcPixelGameEngine.h"
#include "Monster.h"
#include "Animation.h"
#include "config.h"
#include "DEFINES.h"
#include "safemap.h"
INCLUDE_DATA
INCLUDE_STRATEGY_DATA
std::map<MonsterName,MonsterData>MONSTER_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}},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)},
};
std::map<MonsterName,MonsterData>MONSTER_DATA;
MonsterData::MonsterData(){}
MonsterData::MonsterData(MonsterName type,int hp,int atk,std::vector<AnimationState>animations,AnimationState jumpAnimation,AnimationState shootAnimation,AnimationState deathAnimation
MonsterData::MonsterData(MonsterName type,int hp,int atk,std::vector<std::string>animations,std::string jumpAnimation,std::string shootAnimation,std::string 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),deathAnimation(deathAnimation){
}
void MonsterData::InitializeMonsterData(){
for(int i=0;i<MonsterName::END;i++){
std::string ID=DATA["Monsters"][std::to_string(i)]["DisplayName"].GetString(1);
std::vector<std::string>animations{
ID+"_JUMP",
ID+"_SPIT",
ID+"_DIE",
ID+"_IDLE",
};
//Add additional custom animations defined in the config.
int animationCounter=0;
while(DATA["Monsters"][std::to_string(i)].HasProperty("ANIMATION["+std::to_string(animationCounter)+"]")){
animations.push_back(DATA["Monsters"][std::to_string(i)]["ANIMATION["+std::to_string(animationCounter)+"]"].GetString());
animationCounter++;
}
MonsterData monster(
MonsterName(i),
DATA["Monsters"][std::to_string(i)]["Health"].GetInt(),
DATA["Monsters"][std::to_string(i)]["Attack"].GetInt(),
animations,
ID+"_JUMP",
ID+"_SPIT",
ID+"_DIE",
DATA["Monsters"][std::to_string(i)]["MoveSpd"].GetReal()/100,
DATA["Monsters"][std::to_string(i)]["Size"].GetReal()/100,
STRATEGY_DATA[DATA["Monsters"][std::to_string(i)]["Strategy"].GetString()],
DATA["Monsters"][std::to_string(i)]["CollisionDmg"].GetInt()
);
MONSTER_DATA[MonsterName(i)]=monster;
}
}
int MonsterData::GetHealth(){
return hp;
}
@ -44,14 +72,14 @@ MonsterStrategy MonsterData::GetAIStrategy(){
return strategy;
}
AnimationState MonsterData::GetJumpAnimation(){
std::string MonsterData::GetJumpAnimation(){
return jumpAnimation;
}
AnimationState MonsterData::GetShootAnimation(){
std::string MonsterData::GetShootAnimation(){
return shootAnimation;
}
AnimationState MonsterData::GetDeathAnimation()
std::string MonsterData::GetDeathAnimation()
{
return deathAnimation;
}

@ -5,6 +5,7 @@
#include "Bullet.h"
#include "BulletTypes.h"
#include "DEFINES.h"
#include "safemap.h"
INCLUDE_MONSTER_DATA
INCLUDE_MONSTER_LIST
@ -212,14 +213,14 @@ void Player::Update(float fElapsedTime){
if(lastAnimationFlip==0){
lastAnimationFlip=0.03;
facingDirection=DOWN;
animation.ChangeState(internal_animState,AnimationState::WARRIOR_WALK_S);
animation.ChangeState(internal_animState,"WARRIOR_WALK_S");
}
}break;
case DOWN:{
if(lastAnimationFlip==0){
lastAnimationFlip=0.03;
facingDirection=UP;
animation.ChangeState(internal_animState,AnimationState::WARRIOR_WALK_N);
animation.ChangeState(internal_animState,"WARRIOR_WALK_N");
}
}break;
}
@ -237,7 +238,7 @@ void Player::Update(float fElapsedTime){
z=0;
float numb=4;
game->HurtEnemies(pos,"Warrior.Ability 2.Range"_F/100*12,GetAttack()*"Warrior.Ability 2.DamageMult"_F,OnUpperLevel());
game->AddEffect(std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,AnimationState::GROUND_SLAM_ATTACK_FRONT,upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F),std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,AnimationState::GROUND_SLAM_ATTACK_BACK,upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F));
game->AddEffect(std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"GROUND_SLAM_ATTACK_FRONT",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F),std::make_unique<Effect>(GetPos(),"Warrior.Ability 2.EffectLifetime"_F,"GROUND_SLAM_ATTACK_BACK",upperLevel,"Warrior.Ability 2.Range"_F/300*1.33f,"Warrior.Ability 2.EffectFadetime"_F));
}
if(lastAnimationFlip>0){
lastAnimationFlip=std::max(0.f,lastAnimationFlip-fElapsedTime);
@ -254,16 +255,16 @@ void Player::Update(float fElapsedTime){
SetState(NORMAL);
switch(facingDirection){
case DOWN:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_S);
UpdateAnimation("WARRIOR_IDLE_S");
}break;
case RIGHT:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_E);
UpdateAnimation("WARRIOR_IDLE_E");
}break;
case LEFT:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_W);
UpdateAnimation("WARRIOR_IDLE_W");
}break;
case UP:{
UpdateAnimation(AnimationState::WARRIOR_IDLE_N);
UpdateAnimation("WARRIOR_IDLE_N");
}break;
}
}
@ -382,16 +383,16 @@ void Player::Update(float fElapsedTime){
case SWING_SWORD:{
switch(GetFacingDirection()){
case UP:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_N);
UpdateAnimation("WARRIOR_SWINGSWORD_N");
}break;
case DOWN:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_S);
UpdateAnimation("WARRIOR_SWINGSWORD_S");
}break;
case LEFT:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_W);
UpdateAnimation("WARRIOR_SWINGSWORD_W");
}break;
case RIGHT:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_E);
UpdateAnimation("WARRIOR_SWINGSWORD_E");
}break;
}
SetSwordSwingTimer(GetSwordSwingTimer()-fElapsedTime);
@ -503,11 +504,11 @@ bool Player::Hurt(int damage,bool onUpperLevel){
return true;
}
void Player::AddAnimation(AnimationState state){
void Player::AddAnimation(std::string state){
animation.AddState(state,ANIMATION_DATA[state]);
}
void Player::UpdateAnimation(AnimationState animState,int specificClass){
void Player::UpdateAnimation(std::string animState,int specificClass){
if(specificClass==ANY||specificClass&GetClass()){
animation.ChangeState(internal_animState,animState);
}
@ -560,7 +561,7 @@ void Player::Spin(float duration,float spinSpd){
}
void Player::UpdateWalkingAnimation(Key direction){
AnimationState anim;
std::string anim;
switch(direction){
case UP:anim=GetWalkNAnimation();break;
case RIGHT:anim=GetWalkEAnimation();break;
@ -571,7 +572,7 @@ void Player::UpdateWalkingAnimation(Key direction){
}
void Player::UpdateIdleAnimation(Key direction){
AnimationState anim;
std::string anim;
switch(direction){
case UP:anim=GetIdleNAnimation();break;
case RIGHT:anim=GetIdleEAnimation();break;
@ -650,16 +651,16 @@ void Player::SetVelocity(vf2d vel){
void Player::SetAnimationBasedOnTargetingDirection(float targetDirection){
if(GetClass()==Class::RANGER){
if(targetDirection<=PI/4&&targetDirection>-PI/4){
UpdateAnimation(AnimationState::RANGER_SHOOT_E);
UpdateAnimation("RANGER_SHOOT_E");
} else
if(targetDirection>=3*PI/4||targetDirection<-3*PI/4){
UpdateAnimation(AnimationState::RANGER_SHOOT_W);
UpdateAnimation("RANGER_SHOOT_W");
} else
if(targetDirection<=3*PI/4&&targetDirection>PI/4){
UpdateAnimation(AnimationState::RANGER_SHOOT_S);
UpdateAnimation("RANGER_SHOOT_S");
} else
if(targetDirection>=-3*PI/4&&targetDirection<-PI/4){
UpdateAnimation(AnimationState::RANGER_SHOOT_N);
UpdateAnimation("RANGER_SHOOT_N");
}
}
}

@ -42,11 +42,11 @@ private:
std::pair<std::string,float> notEnoughManaDisplay={"",0};
float teleportAttemptWaitTime=0; //If a teleport fails, we wait awhile before trying again, it's expensive.
State state=State::NORMAL;
Animate2D::Animation<AnimationState>animation;
Animate2D::Animation<std::string>animation;
Animate2D::AnimationState internal_animState;
Key lastReleasedMovementKey;
void Update(float fElapsedTime);
void AddAnimation(AnimationState state);
void AddAnimation(std::string state);
std::vector<Buff>buffList;
CastInfo castInfo={"",0};
vf2d movementVelocity={};//This tells us if the player is moving (mostly controlled by user input) since their velocity is not used for regular movement.
@ -138,7 +138,7 @@ public:
bool Hurt(int damage,bool onUpperLevel);
//specificClass is a bitwise-combination of classes from the Class enum. It makes sure certain animations only play if you are a certain class.
void UpdateAnimation(AnimationState animState,int specificClass=ANY);
void UpdateAnimation(std::string animState,int specificClass=ANY);
Animate2D::Frame GetFrame();
Key GetLastReleasedMovementKey();
float GetSwordSwingTimer();
@ -155,14 +155,14 @@ public:
virtual Ability&GetAbility2()=0;
virtual Ability&GetAbility3()=0;
virtual Ability&GetAbility4()=0;
virtual AnimationState&GetWalkNAnimation()=0;
virtual AnimationState&GetWalkEAnimation()=0;
virtual AnimationState&GetWalkSAnimation()=0;
virtual AnimationState&GetWalkWAnimation()=0;
virtual AnimationState&GetIdleNAnimation()=0;
virtual AnimationState&GetIdleEAnimation()=0;
virtual AnimationState&GetIdleSAnimation()=0;
virtual AnimationState&GetIdleWAnimation()=0;
virtual std::string&GetWalkNAnimation()=0;
virtual std::string&GetWalkEAnimation()=0;
virtual std::string&GetWalkSAnimation()=0;
virtual std::string&GetWalkWAnimation()=0;
virtual std::string&GetIdleNAnimation()=0;
virtual std::string&GetIdleEAnimation()=0;
virtual std::string&GetIdleSAnimation()=0;
virtual std::string&GetIdleWAnimation()=0;
CastInfo&GetCastInfo();
void SetAnimationBasedOnTargetingDirection(float targetDirection);
@ -172,7 +172,7 @@ struct Warrior:Player{
static std::string name;
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static std::string walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Warrior();
Warrior(Player*player);
@ -187,21 +187,21 @@ struct Warrior:Player{
Ability&GetAbility2()override;
Ability&GetAbility3()override;
Ability&GetAbility4()override;
AnimationState&GetWalkNAnimation()override;
AnimationState&GetWalkEAnimation()override;
AnimationState&GetWalkSAnimation()override;
AnimationState&GetWalkWAnimation()override;
AnimationState&GetIdleNAnimation()override;
AnimationState&GetIdleEAnimation()override;
AnimationState&GetIdleSAnimation()override;
AnimationState&GetIdleWAnimation()override;
std::string&GetWalkNAnimation()override;
std::string&GetWalkEAnimation()override;
std::string&GetWalkSAnimation()override;
std::string&GetWalkWAnimation()override;
std::string&GetIdleNAnimation()override;
std::string&GetIdleEAnimation()override;
std::string&GetIdleSAnimation()override;
std::string&GetIdleWAnimation()override;
};
struct Thief:Player{
static std::string name;
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static std::string walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Thief();
Thief(Player*player);
@ -216,21 +216,21 @@ struct Thief:Player{
Ability&GetAbility2()override;
Ability&GetAbility3()override;
Ability&GetAbility4()override;
AnimationState&GetWalkNAnimation()override;
AnimationState&GetWalkEAnimation()override;
AnimationState&GetWalkSAnimation()override;
AnimationState&GetWalkWAnimation()override;
AnimationState&GetIdleNAnimation()override;
AnimationState&GetIdleEAnimation()override;
AnimationState&GetIdleSAnimation()override;
AnimationState&GetIdleWAnimation()override;
std::string&GetWalkNAnimation()override;
std::string&GetWalkEAnimation()override;
std::string&GetWalkSAnimation()override;
std::string&GetWalkWAnimation()override;
std::string&GetIdleNAnimation()override;
std::string&GetIdleEAnimation()override;
std::string&GetIdleSAnimation()override;
std::string&GetIdleWAnimation()override;
};
struct Ranger:Player{
static std::string name;
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static std::string walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Ranger();
Ranger(Player*player);
@ -245,21 +245,21 @@ struct Ranger:Player{
Ability&GetAbility2()override;
Ability&GetAbility3()override;
Ability&GetAbility4()override;
AnimationState&GetWalkNAnimation()override;
AnimationState&GetWalkEAnimation()override;
AnimationState&GetWalkSAnimation()override;
AnimationState&GetWalkWAnimation()override;
AnimationState&GetIdleNAnimation()override;
AnimationState&GetIdleEAnimation()override;
AnimationState&GetIdleSAnimation()override;
AnimationState&GetIdleWAnimation()override;
std::string&GetWalkNAnimation()override;
std::string&GetWalkEAnimation()override;
std::string&GetWalkSAnimation()override;
std::string&GetWalkWAnimation()override;
std::string&GetIdleNAnimation()override;
std::string&GetIdleEAnimation()override;
std::string&GetIdleSAnimation()override;
std::string&GetIdleWAnimation()override;
};
struct Trapper:Player{
static std::string name;
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static std::string walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Trapper();
Trapper(Player*player);
@ -274,21 +274,21 @@ struct Trapper:Player{
Ability&GetAbility2()override;
Ability&GetAbility3()override;
Ability&GetAbility4()override;
AnimationState&GetWalkNAnimation()override;
AnimationState&GetWalkEAnimation()override;
AnimationState&GetWalkSAnimation()override;
AnimationState&GetWalkWAnimation()override;
AnimationState&GetIdleNAnimation()override;
AnimationState&GetIdleEAnimation()override;
AnimationState&GetIdleSAnimation()override;
AnimationState&GetIdleWAnimation()override;
std::string&GetWalkNAnimation()override;
std::string&GetWalkEAnimation()override;
std::string&GetWalkSAnimation()override;
std::string&GetWalkWAnimation()override;
std::string&GetIdleNAnimation()override;
std::string&GetIdleEAnimation()override;
std::string&GetIdleSAnimation()override;
std::string&GetIdleWAnimation()override;
};
struct Wizard:Player{
static std::string name;
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static std::string walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Wizard();
Wizard(Player*player);
@ -303,21 +303,21 @@ struct Wizard:Player{
Ability&GetAbility2()override;
Ability&GetAbility3()override;
Ability&GetAbility4()override;
AnimationState&GetWalkNAnimation()override;
AnimationState&GetWalkEAnimation()override;
AnimationState&GetWalkSAnimation()override;
AnimationState&GetWalkWAnimation()override;
AnimationState&GetIdleNAnimation()override;
AnimationState&GetIdleEAnimation()override;
AnimationState&GetIdleSAnimation()override;
AnimationState&GetIdleWAnimation()override;
std::string&GetWalkNAnimation()override;
std::string&GetWalkEAnimation()override;
std::string&GetWalkSAnimation()override;
std::string&GetWalkWAnimation()override;
std::string&GetIdleNAnimation()override;
std::string&GetIdleEAnimation()override;
std::string&GetIdleSAnimation()override;
std::string&GetIdleWAnimation()override;
};
struct Witch:Player{
static std::string name;
static Class cl;
static Ability rightClickAbility,ability1,ability2,ability3,ability4;
static AnimationState walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static std::string walk_n,walk_e,walk_s,walk_w,idle_n,idle_e,idle_s,idle_w;
static void Initialize();
Witch();
Witch(Player*player);
@ -332,14 +332,14 @@ struct Witch:Player{
Ability&GetAbility2()override;
Ability&GetAbility3()override;
Ability&GetAbility4()override;
AnimationState&GetWalkNAnimation()override;
AnimationState&GetWalkEAnimation()override;
AnimationState&GetWalkSAnimation()override;
AnimationState&GetWalkWAnimation()override;
AnimationState&GetIdleNAnimation()override;
AnimationState&GetIdleEAnimation()override;
AnimationState&GetIdleSAnimation()override;
AnimationState&GetIdleWAnimation()override;
std::string&GetWalkNAnimation()override;
std::string&GetWalkEAnimation()override;
std::string&GetWalkSAnimation()override;
std::string&GetWalkWAnimation()override;
std::string&GetIdleNAnimation()override;
std::string&GetIdleEAnimation()override;
std::string&GetIdleSAnimation()override;
std::string&GetIdleWAnimation()override;
};
#define READFROMCONFIG(class,enum) \

@ -2,12 +2,13 @@
#include "DEFINES.h"
#include "Crawler.h"
#include "utils.h"
#include "safemap.h"
INCLUDE_game
INCLUDE_ANIMATION_DATA
INCLUDE_MONSTER_LIST
PulsatingFire::PulsatingFire(vf2d pos, float lifetime, AnimationState animation, bool upperLevel, vf2d size, float fadeout, vf2d spd, Pixel col, float rotation, float rotationSpd, bool additiveBlending)
PulsatingFire::PulsatingFire(vf2d pos, float lifetime, std::string animation, bool upperLevel, vf2d size, float fadeout, vf2d spd, Pixel col, float rotation, float rotationSpd, bool additiveBlending)
:Effect(pos,lifetime,animation,upperLevel,size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){
for(int i=0;i<8;i++){
pulsatingFireValues.push_back(util::random(1));
@ -24,7 +25,7 @@ bool PulsatingFire::Update(float fElapsedTime){
float randomRange=12*size.x*(1-util::random("Wizard.Ability 3.FireRingParticleRandomVariance"_F))*(1-util::random("Wizard.Ability 3.FireRingParticleRandomVariance"_F));
float randomColorTintG=128*(1-util::random("Wizard.Ability 3.FireRingParticleColorGVariance"_F))*(1-util::random("Wizard.Ability 3.FireRingParticleColorGVariance"_F));
float randomColorTint="Wizard.Ability 3.FireRingParticleColorBlueRange"_FRange;
game->AddEffect(std::make_unique<Effect>(pos+vf2d{cos(randomAngle),sin(randomAngle)}*randomRange,0,AnimationState::DOT_PARTICLE,OnUpperLevel(),vf2d{"Wizard.Ability 3.FireRingParticleXSizeRange"_FRange,"Wizard.Ability 3.FireRingParticleYSizeRange"_FRange},"Wizard.Ability 3.FireRingParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 3.FireRingParticleXSpeedRange"_FRange,"Wizard.Ability 3.FireRingParticleYSpeedRange"_FRange},Pixel{128,uint8_t(randomColorTintG),uint8_t(randomColorTint),uint8_t("Wizard.Ability 3.FireRingParticleAlphaRange"_FRange)}));
game->AddEffect(std::make_unique<Effect>(pos+vf2d{cos(randomAngle),sin(randomAngle)}*randomRange,0,"DOT_PARTICLE",OnUpperLevel(),vf2d{"Wizard.Ability 3.FireRingParticleXSizeRange"_FRange,"Wizard.Ability 3.FireRingParticleYSizeRange"_FRange},"Wizard.Ability 3.FireRingParticleFadeoutTimeRange"_FRange,vf2d{"Wizard.Ability 3.FireRingParticleXSpeedRange"_FRange,"Wizard.Ability 3.FireRingParticleYSpeedRange"_FRange},Pixel{128,uint8_t(randomColorTintG),uint8_t(randomColorTint),uint8_t("Wizard.Ability 3.FireRingParticleAlphaRange"_FRange)}));
}
lastParticleTimer="Wizard.Ability 3.FireRingParticleFreqRange"_FRange;
}
@ -40,22 +41,22 @@ void PulsatingFire::Draw(){
Animate2D::FrameSequence*effectSpr=nullptr;
switch(int(pulsatingFireValues[i]*5)){
case 0:{
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING1];
effectSpr=&ANIMATION_DATA["FIRE_RING1"];
}break;
case 1:{
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING2];
effectSpr=&ANIMATION_DATA["FIRE_RING2"];
}break;
case 2:{
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING3];
effectSpr=&ANIMATION_DATA["FIRE_RING3"];
}break;
case 3:{
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING4];
effectSpr=&ANIMATION_DATA["FIRE_RING4"];
}break;
case 4:{
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING5];
effectSpr=&ANIMATION_DATA["FIRE_RING5"];
}break;
default:
effectSpr=&ANIMATION_DATA[AnimationState::FIRE_RING1];
effectSpr=&ANIMATION_DATA["FIRE_RING1"];
}
const Renderable*img=effectSpr->GetFrame(0).GetSourceImage();
game->view.DrawPartialDecal(pos-effectSpr->GetFrame(0).GetSourceRect().size/2*size,img->Decal(),effectSpr->GetFrame(0).GetSourceRect().pos,effectSpr->GetFrame(0).GetSourceRect().size,size,{255,uint8_t(pulsatingFireValues[i]*256),0,uint8_t((63*(sin("Wizard.Ability 3.FireRingOscillatingFrequency"_F*lifetime+PI*pulsatingFireValues[i]))+63)*(fadeout/original_fadeoutTime))});

@ -14,14 +14,14 @@ INCLUDE_game
void Ranger::Initialize(){
READFROMCONFIG(Ranger,RANGER);
Ranger::idle_n=RANGER_IDLE_N;
Ranger::idle_e=RANGER_IDLE_E;
Ranger::idle_s=RANGER_IDLE_S;
Ranger::idle_w=RANGER_IDLE_W;
Ranger::walk_n=RANGER_WALK_N;
Ranger::walk_e=RANGER_WALK_E;
Ranger::walk_s=RANGER_WALK_S;
Ranger::walk_w=RANGER_WALK_W;
Ranger::idle_n="RANGER_IDLE_N";
Ranger::idle_e="RANGER_IDLE_E";
Ranger::idle_s="RANGER_IDLE_S";
Ranger::idle_w="RANGER_IDLE_W";
Ranger::walk_n="RANGER_WALK_N";
Ranger::walk_e="RANGER_WALK_E";
Ranger::walk_s="RANGER_WALK_S";
Ranger::walk_w="RANGER_WALK_W";
}
SETUP_CLASS(Ranger)

@ -12,14 +12,14 @@ INCLUDE_game
void Thief::Initialize(){
READFROMCONFIG(Thief,THIEF);
Thief::idle_n=WARRIOR_IDLE_N;
Thief::idle_e=WARRIOR_IDLE_E;
Thief::idle_s=WARRIOR_IDLE_S;
Thief::idle_w=WARRIOR_IDLE_W;
Thief::walk_n=WARRIOR_WALK_N;
Thief::walk_e=WARRIOR_WALK_E;
Thief::walk_s=WARRIOR_WALK_S;
Thief::walk_w=WARRIOR_WALK_W;
Thief::idle_n="WARRIOR_IDLE_N";
Thief::idle_e="WARRIOR_IDLE_E";
Thief::idle_s="WARRIOR_IDLE_S";
Thief::idle_w="WARRIOR_IDLE_W";
Thief::walk_n="WARRIOR_WALK_N";
Thief::walk_e="WARRIOR_WALK_E";
Thief::walk_s="WARRIOR_WALK_S";
Thief::walk_w="WARRIOR_WALK_W";
}
SETUP_CLASS(Thief)

@ -12,14 +12,14 @@ INCLUDE_game
void Trapper::Initialize(){
READFROMCONFIG(Trapper,TRAPPER);
Trapper::idle_n=WARRIOR_IDLE_N;
Trapper::idle_e=WARRIOR_IDLE_E;
Trapper::idle_s=WARRIOR_IDLE_S;
Trapper::idle_w=WARRIOR_IDLE_W;
Trapper::walk_n=WARRIOR_WALK_N;
Trapper::walk_e=WARRIOR_WALK_E;
Trapper::walk_s=WARRIOR_WALK_S;
Trapper::walk_w=WARRIOR_WALK_W;
Trapper::idle_n="WARRIOR_IDLE_N";
Trapper::idle_e="WARRIOR_IDLE_E";
Trapper::idle_s="WARRIOR_IDLE_S";
Trapper::idle_w="WARRIOR_IDLE_W";
Trapper::walk_n="WARRIOR_WALK_N";
Trapper::walk_e="WARRIOR_WALK_E";
Trapper::walk_s="WARRIOR_WALK_S";
Trapper::walk_w="WARRIOR_WALK_W";
}
SETUP_CLASS(Trapper)

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
#define VERSION_BUILD 962
#define VERSION_BUILD 976
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -12,14 +12,14 @@ INCLUDE_game
void Warrior::Initialize(){
READFROMCONFIG(Warrior,WARRIOR);
Warrior::idle_n=WARRIOR_IDLE_N;
Warrior::idle_e=WARRIOR_IDLE_E;
Warrior::idle_s=WARRIOR_IDLE_S;
Warrior::idle_w=WARRIOR_IDLE_W;
Warrior::walk_n=WARRIOR_WALK_N;
Warrior::walk_e=WARRIOR_WALK_E;
Warrior::walk_s=WARRIOR_WALK_S;
Warrior::walk_w=WARRIOR_WALK_W;
Warrior::idle_n="WARRIOR_IDLE_N";
Warrior::idle_e="WARRIOR_IDLE_E";
Warrior::idle_s="WARRIOR_IDLE_S";
Warrior::idle_w="WARRIOR_IDLE_W";
Warrior::walk_n="WARRIOR_WALK_N";
Warrior::walk_e="WARRIOR_WALK_E";
Warrior::walk_s="WARRIOR_WALK_S";
Warrior::walk_w="WARRIOR_WALK_W";
}
SETUP_CLASS(Warrior)
@ -48,16 +48,16 @@ bool Warrior::AutoAttack(){
SetState(State::SWING_SWORD);
switch(facingDirection){
case DOWN:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_S,WARRIOR|THIEF);
UpdateAnimation("WARRIOR_SWINGSWORD_S",WARRIOR|THIEF);
}break;
case RIGHT:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_E,WARRIOR|THIEF);
UpdateAnimation("WARRIOR_SWINGSWORD_E",WARRIOR|THIEF);
}break;
case LEFT:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_W,WARRIOR|THIEF);
UpdateAnimation("WARRIOR_SWINGSWORD_W",WARRIOR|THIEF);
}break;
case UP:{
UpdateAnimation(AnimationState::WARRIOR_SWINGSWORD_N,WARRIOR|THIEF);
UpdateAnimation("WARRIOR_SWINGSWORD_N",WARRIOR|THIEF);
}break;
}
}
@ -81,7 +81,7 @@ void Warrior::InitializeClassAbilities(){
#pragma region Warrior Ability 1 (Battlecry)
Warrior::ability1.action=
[](Player*p,vf2d pos={}){
game->AddEffect(std::make_unique<Effect>(p->GetPos(),"Warrior.Ability 1.EffectLifetime"_F,AnimationState::BATTLECRY_EFFECT,p->upperLevel,"Warrior.Ability 1.Range"_F/350,"Warrior.Ability 1.EffectFadetime"_F));
game->AddEffect(std::make_unique<Effect>(p->GetPos(),"Warrior.Ability 1.EffectLifetime"_F,"BATTLECRY_EFFECT",p->upperLevel,"Warrior.Ability 1.Range"_F/350,"Warrior.Ability 1.EffectFadetime"_F));
p->AddBuff(BuffType::ATTACK_UP,"Warrior.Ability 1.AttackUpDuration"_F,"Warrior.Ability 1.AttackIncrease"_F);
p->AddBuff(BuffType::DAMAGE_REDUCTION,"Warrior.Ability 1.DamageReductionDuration"_F,"Warrior.Ability 1.DamageReduction"_F);
for(Monster&m:MONSTER_LIST){
@ -110,25 +110,25 @@ void Warrior::InitializeClassAbilities(){
case UP:{
p->vel.y="Warrior.Ability 3.AbilityPushback"_F;
bulletVel.y=-"Warrior.Ability 3.BulletSpd"_F;
p->UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_N,WARRIOR);
p->UpdateAnimation("WARRIOR_SWINGSONICSWORD_N",WARRIOR);
}break;
case LEFT:{
p->vel.x="Warrior.Ability 3.AbilityPushback"_F;
bulletVel.x=-"Warrior.Ability 3.BulletSpd"_F;
p->UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_W,WARRIOR);
p->UpdateAnimation("WARRIOR_SWINGSONICSWORD_W",WARRIOR);
}break;
case RIGHT:{
p->vel.x=-"Warrior.Ability 3.AbilityPushback"_F;
bulletVel.x="Warrior.Ability 3.BulletSpd"_F;
p->UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_E,WARRIOR);
p->UpdateAnimation("WARRIOR_SWINGSONICSWORD_E",WARRIOR);
}break;
case DOWN:{
p->vel.y=-"Warrior.Ability 3.AbilityPushback"_F;
bulletVel.y="Warrior.Ability 3.BulletSpd"_F;
p->UpdateAnimation(AnimationState::WARRIOR_SWINGSONICSWORD_S,WARRIOR);
p->UpdateAnimation("WARRIOR_SWINGSONICSWORD_S",WARRIOR);
}break;
}
BULLET_LIST.push_back(std::make_unique<Bullet>(p->GetPos(),bulletVel,"Warrior.Ability 3.Radius"_F,p->GetAttack()*"Warrior.Ability 3.DamageMult"_F,AnimationState::SONICSLASH,p->upperLevel,true,"Warrior.Ability 3.Lifetime"_F,true,true,WHITE,vf2d{"Warrior.Ability 3.Radius"_F/30,"Warrior.Ability 3.Radius"_F/30}));
BULLET_LIST.push_back(std::make_unique<Bullet>(p->GetPos(),bulletVel,"Warrior.Ability 3.Radius"_F,p->GetAttack()*"Warrior.Ability 3.DamageMult"_F,"SONICSLASH",p->upperLevel,true,"Warrior.Ability 3.Lifetime"_F,true,true,WHITE,vf2d{"Warrior.Ability 3.Radius"_F/30,"Warrior.Ability 3.Radius"_F/30}));
game->SetupWorldShake("Warrior.Ability 3.ShakeTime"_F);
return true;
};

@ -12,14 +12,14 @@ INCLUDE_game
void Witch::Initialize(){
READFROMCONFIG(Witch,WITCH);
Witch::idle_n=WARRIOR_IDLE_N;
Witch::idle_e=WARRIOR_IDLE_E;
Witch::idle_s=WARRIOR_IDLE_S;
Witch::idle_w=WARRIOR_IDLE_W;
Witch::walk_n=WARRIOR_WALK_N;
Witch::walk_e=WARRIOR_WALK_E;
Witch::walk_s=WARRIOR_WALK_S;
Witch::walk_w=WARRIOR_WALK_W;
Witch::idle_n="WARRIOR_IDLE_N";
Witch::idle_e="WARRIOR_IDLE_E";
Witch::idle_s="WARRIOR_IDLE_S";
Witch::idle_w="WARRIOR_IDLE_W";
Witch::walk_n="WARRIOR_WALK_N";
Witch::walk_e="WARRIOR_WALK_E";
Witch::walk_s="WARRIOR_WALK_S";
Witch::walk_w="WARRIOR_WALK_W";
}
SETUP_CLASS(Witch)

@ -14,51 +14,51 @@ INCLUDE_game
void Wizard::Initialize(){
READFROMCONFIG(Wizard,WIZARD);
Wizard::idle_n=WIZARD_IDLE_N;
Wizard::idle_e=WIZARD_IDLE_E;
Wizard::idle_s=WIZARD_IDLE_S;
Wizard::idle_w=WIZARD_IDLE_W;
Wizard::walk_n=WIZARD_WALK_N;
Wizard::walk_e=WIZARD_WALK_E;
Wizard::walk_s=WIZARD_WALK_S;
Wizard::walk_w=WIZARD_WALK_W;
Wizard::idle_n="WIZARD_IDLE_N";
Wizard::idle_e="WIZARD_IDLE_E";
Wizard::idle_s="WIZARD_IDLE_S";
Wizard::idle_w="WIZARD_IDLE_W";
Wizard::walk_n="WIZARD_WALK_N";
Wizard::walk_e="WIZARD_WALK_E";
Wizard::walk_s="WIZARD_WALK_S";
Wizard::walk_w="WIZARD_WALK_W";
}
SETUP_CLASS(Wizard)
void Wizard::OnUpdate(float fElapsedTime){
if(attack_cooldown_timer>0){
idle_n=AnimationState::WIZARD_IDLE_ATTACK_N;
idle_e=AnimationState::WIZARD_IDLE_ATTACK_E;
idle_s=AnimationState::WIZARD_IDLE_ATTACK_S;
idle_w=AnimationState::WIZARD_IDLE_ATTACK_W;
walk_n=AnimationState::WIZARD_ATTACK_N;
walk_e=AnimationState::WIZARD_ATTACK_E;
walk_s=AnimationState::WIZARD_ATTACK_S;
walk_w=AnimationState::WIZARD_ATTACK_W;
idle_n="WIZARD_IDLE_ATTACK_N";
idle_e="WIZARD_IDLE_ATTACK_E";
idle_s="WIZARD_IDLE_ATTACK_S";
idle_w="WIZARD_IDLE_ATTACK_W";
walk_n="WIZARD_ATTACK_N";
walk_e="WIZARD_ATTACK_E";
walk_s="WIZARD_ATTACK_S";
walk_w="WIZARD_ATTACK_W";
} else {
idle_n=AnimationState::WIZARD_IDLE_N;
idle_e=AnimationState::WIZARD_IDLE_E;
idle_s=AnimationState::WIZARD_IDLE_S;
idle_w=AnimationState::WIZARD_IDLE_W;
walk_n=AnimationState::WIZARD_WALK_N;
walk_e=AnimationState::WIZARD_WALK_E;
walk_s=AnimationState::WIZARD_WALK_S;
walk_w=AnimationState::WIZARD_WALK_W;
idle_n="WIZARD_IDLE_N";
idle_e="WIZARD_IDLE_E";
idle_s="WIZARD_IDLE_S";
idle_w="WIZARD_IDLE_W";
walk_n="WIZARD_WALK_N";
walk_e="WIZARD_WALK_E";
walk_s="WIZARD_WALK_S";
walk_w="WIZARD_WALK_W";
}
if(GetState()==State::CASTING){
switch(GetFacingDirection()){
case UP:{
UpdateAnimation(AnimationState::WIZARD_CAST_N,WIZARD|WITCH);
UpdateAnimation("WIZARD_CAST_N",WIZARD|WITCH);
}break;
case DOWN:{
UpdateAnimation(AnimationState::WIZARD_CAST_S,WIZARD|WITCH);
UpdateAnimation("WIZARD_CAST_S",WIZARD|WITCH);
}break;
case LEFT:{
UpdateAnimation(AnimationState::WIZARD_CAST_W,WIZARD|WITCH);
UpdateAnimation("WIZARD_CAST_W",WIZARD|WITCH);
}break;
case RIGHT:{
UpdateAnimation(AnimationState::WIZARD_CAST_E,WIZARD|WITCH);
UpdateAnimation("WIZARD_CAST_E",WIZARD|WITCH);
}break;
}
}
@ -91,7 +91,7 @@ void Wizard::InitializeClassAbilities(){
p->teleportStartPosition=p->GetPos();
p->iframe_time="Wizard.Right Click Ability.IframeTime"_F;
for(int i=0;i<"Wizard.Right Click Ability.ParticleCount"_I;i++){
game->AddEffect(std::make_unique<Effect>(p->GetPos()+vf2d{(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)-"Wizard.Right Click Ability.ParticleRange"_F/100)*12,(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)-"Wizard.Right Click Ability.ParticleRange"_F/100)*12},util::random("Wizard.Right Click Ability.ParticleLifetimeMax"_F)+"Wizard.Right Click Ability.ParticleLifetimeMin"_F,AnimationState::DOT_PARTICLE,p->upperLevel,"Wizard.Right Click Ability.ParticleSize"_F,"Wizard.Right Click Ability.ParticleFadetime"_F,vf2d{util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+"Wizard.Right Click Ability.ParticleSpeedMin"_F,util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+"Wizard.Right Click Ability.ParticleSpeedMin"_F},"Wizard.Right Click Ability.ParticleColor"_Pixel));
game->AddEffect(std::make_unique<Effect>(p->GetPos()+vf2d{(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)-"Wizard.Right Click Ability.ParticleRange"_F/100)*12,(util::random("Wizard.Right Click Ability.ParticleRange"_F/100*2)-"Wizard.Right Click Ability.ParticleRange"_F/100)*12},util::random("Wizard.Right Click Ability.ParticleLifetimeMax"_F)+"Wizard.Right Click Ability.ParticleLifetimeMin"_F,"DOT_PARTICLE",p->upperLevel,"Wizard.Right Click Ability.ParticleSize"_F,"Wizard.Right Click Ability.ParticleFadetime"_F,vf2d{util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+"Wizard.Right Click Ability.ParticleSpeedMin"_F,util::random("Wizard.Right Click Ability.ParticleSpeedMax"_F*2)+"Wizard.Right Click Ability.ParticleSpeedMin"_F},"Wizard.Right Click Ability.ParticleColor"_Pixel));
}
return true;
} else {
@ -120,7 +120,7 @@ void Wizard::InitializeClassAbilities(){
Wizard::ability3.action=
[](Player*p,vf2d pos={}){
p->CastSpell(Wizard::ability3);
game->AddEffect(std::make_unique<Meteor>(pos,3,AnimationState::METEOR,p->OnUpperLevel(),vf2d{"Wizard.Ability 3.MeteorRadius"_F/100/4,"Wizard.Ability 3.MeteorRadius"_F/100/4},"Wizard.Ability 3.MeteorFadeoutTime"_F));
game->AddEffect(std::make_unique<Meteor>(pos,3,"METEOR",p->OnUpperLevel(),vf2d{"Wizard.Ability 3.MeteorRadius"_F/100/4,"Wizard.Ability 3.MeteorRadius"_F/100/4},"Wizard.Ability 3.MeteorFadeoutTime"_F));
return true;
};
#pragma endregion

@ -0,0 +1,69 @@
# Monster Strategies have optional parameters that you can adjust to
# tweak the AI behaviors. Each strategy is displayed followed by {}.
# Inside the {} is a list of the properties and what their default values
# are.
#
# If you add the optional parameters inside a Monster, they will be adopted
# for that specific AI pattern.
#
# For example, if you wanted to add a longer wait time to a mob's RUN_TOWARDS
# strategy, you would write this:
#
# ==========================================
# ==========================================
#
# Monster0
# {
# Name = Green Slime
# Health = 10
# Attack = 5
#
# CollisionDmg = 5
#
# MoveSpd = 110
# Size = 80
#
# Strategy = RUN_TOWARDS
# WaitTime = 5
#
# [....Cut for length purposes]
#
# ==========================================
# ==========================================
# ==========================================
#
# The document below shows that WaitTime is 2 by default, but this will make the
# mob adopt a 5 second wait time.
MonsterStrategy
{
0
{
Name = RUN_TOWARDS
# How long to wait before attempting to path again.
WaitTime = 2
# How far the monster will travel before reassessing for a new path.
MaxDistance = 999999
}
1
{
Name = SHOOT_AFAR
# How far away the monster attempts to distance itself from the player
Range = 800
# How often the enemy shoots.
ShootingSpeed = 1
BulletSpeed = 100
BulletSize = 100
BulletColor = 0, 0, 255, 255
}
2
{
Name = TURRET
# How far away the monster starts from shooting from
Range = 800
# How often the enemy shoots.
ShootingSpeed = 1
BulletSpeed = 100
BulletSize = 100
BulletColor = 0, 0, 255, 255
}
}

@ -0,0 +1,83 @@
Monsters
{
0
{
DisplayName = Green Slime, GREEN_SLIME
Health = 10
Attack = 5
CollisionDmg = 5
MoveSpd = 110
Size = 80
Strategy = RUN_TOWARDS
#Additional custom animations go down below. Start with ANIMATION[0]
#ANIMATION[0] = MY_NEW_ANIMATION
}
1
{
DisplayName = Blue Slime, BLUE_SLIME
Health = 30
Attack = 10
CollisionDmg = 0
MoveSpd = 80
Size = 100
Strategy = SHOOT_AFAR
#Additional custom animations go down below. Start with ANIMATION[0]
#ANIMATION[0] = MY_NEW_ANIMATION
}
2
{
DisplayName = Red Slime, RED_SLIME
Health = 25
Attack = 10
CollisionDmg = 10
MoveSpd = 95
Size = 120
Strategy = RUN_TOWARDS
#Additional custom animations go down below. Start with ANIMATION[0]
#ANIMATION[0] = MY_NEW_ANIMATION
}
3
{
DisplayName = Yellow Slime, YELLOW_SLIME
Health = 175
Attack = 10
CollisionDmg = 15
MoveSpd = 40
Size = 160
Strategy = RUN_TOWARDS
#Additional custom animations go down below. Start with ANIMATION[0]
#ANIMATION[0] = MY_NEW_ANIMATION
}
4
{
DisplayName = Flower Turret, FLOWER_TURRET
Health = 40
Attack = 10
CollisionDmg = 0
MoveSpd = 0
Size = 100
Strategy = TURRET
#Additional custom animations go down below. Start with ANIMATION[0]
#ANIMATION[0] = MY_NEW_ANIMATION
}
}

@ -12,6 +12,12 @@ map_config = levels.txt
# Player Properties Loading Config
player_config = Player.txt
# Monster Properties Loading Config
monsters_config = Monsters.txt
# Monster Strategy Config
monsterstrategies_config = MonsterStrategies.txt
# Path to class configuration files
class_directory = classes/

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<objecttypes>
<objecttype name="Bridge" color="#290aa4"/>
<objecttype name="Door" color="#bdc34c">
<property name="connection" type="string" default="./maps/Level2.tmx"/>
<property name="tileX" type="int" default="0"/>
<property name="tileY" type="int" default="0"/>
</objecttype>
<objecttype name="ForegroundTile" color="#d9d929"/>
<objecttype name="LowerBridgeCollision" color="#c3ae44"/>
<objecttype name="LowerZone" color="#5724a4"/>
<objecttype name="Monster" color="#aa0000">
<property name="Type" type="int" propertytype="MonsterName" default="0"/>
<property name="spawner" type="object" default="0"/>
</objecttype>
<objecttype name="PlayerSpawnLocation" color="#fa00f6"/>
<objecttype name="SpawnGroup" color="#e67300"/>
<objecttype name="Staircase" color="#ffaa00">
<property name="climbingDirection" type="string" propertytype="StaircaseDirection" default="LEFT"/>
</objecttype>
<objecttype name="Teleporter" color="#9200e6">
<property name="connection" type="object" default="0"/>
</objecttype>
<objecttype name="UpperForegroundTile" color="#35e500"/>
<objecttype name="UpperSpawnGroup" color="#ff74fd"/>
<objecttype name="UpperZone" color="#a40aa4"/>
</objecttypes>

@ -0,0 +1,3 @@
#include "safemap.h"
safemap::initializeCompleted=false;

@ -0,0 +1,19 @@
#pragma once
#include "olcPixelGameEngine.h"
//A class that has an initialization lock so that when the lock is activated, any further gets that are missing items in it will report themselves for easier debugging detection.
template<typename T,typename O>
class safemap{
std::map<T,O>map;
bool initialized=false;
public:
O&operator[](T key){
if(initialized&&map.count(key)==0){
std::cout<<"WARNING! Trying to get non-existent key "<<key<<"!"<<std::endl;
}
return map[key];
}
void SetInitialized(){
initialized=true;
}
};
Loading…
Cancel
Save