Projectile shot Phase 2 attack and casting animation implemented.

pull/28/head
sigonasr2 1 year ago
parent 3c3d32bf7e
commit adf7820093
  1. 2
      Crawler/Animation.cpp
  2. 1
      Crawler/MonsterAttribute.h
  3. 22
      Crawler/SlimeKing.cpp
  4. 2
      Crawler/Version.h
  5. 2
      Crawler/assets/config/MonsterStrategies.txt
  6. 3
      Crawler/assets/config/Monsters.txt
  7. 1
      Crawler/assets/config/gfx/gfx.txt
  8. BIN
      Crawler/assets/monsters/Slime King - Cast.png
  9. 4
      Crawler/utils.cpp
  10. 2
      Crawler/utils.h

@ -197,6 +197,8 @@ void sig::Animation::InitializeAnimations(){
CreateHorizontalAnimationSequence("lightning_splash_effect.png",5,{24,24}); CreateHorizontalAnimationSequence("lightning_splash_effect.png",5,{24,24});
CreateHorizontalAnimationSequence("monsters/Slime King - Cast.png",10,{24,24});
CreateStillAnimation("meteor.png",{192,192}); CreateStillAnimation("meteor.png",{192,192});
for(int i=0;i<5;i++){ for(int i=0;i<5;i++){

@ -21,4 +21,5 @@ enum class Attribute{
JUMP_ORIGINAL_POS, JUMP_ORIGINAL_POS,
RECOVERY_TIME, RECOVERY_TIME,
SHOOT_ANIMATION_TIME, SHOOT_ANIMATION_TIME,
SHOOT_TIMER,
}; };

@ -19,6 +19,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
float bulletSpd=ConfigFloat("BulletSpd")/100*24; float bulletSpd=ConfigFloat("BulletSpd")/100*24;
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime);
m.F(A::SHOOT_RING_TIMER)=std::max(0.f,m.F(A::SHOOT_RING_TIMER)-fElapsedTime); m.F(A::SHOOT_RING_TIMER)=std::max(0.f,m.F(A::SHOOT_RING_TIMER)-fElapsedTime);
m.F(A::SHOOT_RING_DELAY)=std::max(0.f,m.F(A::SHOOT_RING_DELAY)-fElapsedTime); m.F(A::SHOOT_RING_DELAY)=std::max(0.f,m.F(A::SHOOT_RING_DELAY)-fElapsedTime);
m.F(A::JUMP_LANDING_TIMER)=std::max(0.f,m.F(A::JUMP_LANDING_TIMER)-fElapsedTime); m.F(A::JUMP_LANDING_TIMER)=std::max(0.f,m.F(A::JUMP_LANDING_TIMER)-fElapsedTime);
@ -138,13 +139,18 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
return; return;
} }
if(m.state==State::CASTING){
m.UpdateAnimation("monsters/Slime King - Cast.png");
return;
}
switch(m.phase){ switch(m.phase){
case 0:{ case 0:{
m.size=ConfigInt("Phase1.Size")/100; m.size=ConfigInt("Phase1.Size")/100;
m.diesNormally=false; m.diesNormally=false;
m.F(A::IFRAME_TIME_UPON_HIT)=0; m.F(A::IFRAME_TIME_UPON_HIT)=0;
m.iframe_timer=ConfigFloat("Phase5.IframeTimePerHit"); m.iframe_timer=ConfigFloat("Phase5.IframeTimePerHit");
m.phase=1; m.phase=ConfigInt("StartPhase");
}break; }break;
case 1:{ case 1:{
if(m.hp<=m.maxhp*ConfigFloat("Phase2.Change")/100){ if(m.hp<=m.maxhp*ConfigFloat("Phase2.Change")/100){
@ -186,6 +192,20 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,int strategyNumbe
TransitionPhase(m.phase); TransitionPhase(m.phase);
return; return;
} }
if(m.F(A::SHOOT_TIMER)==0){
m.F(A::SHOOT_TIMER)=ConfigInt("Phase2.ShootRate");
m.I(A::PATTERN_REPEAT_COUNT)++;
int bulletCount=ConfigInt("Phase2.ShootProjectileCount");
for(int i=0;i<bulletCount;i++){
float initialAngle=util::angleTo(m.GetPos(),game->GetPlayer()->GetPos());
float angle=(i-(bulletCount/2))*util::degToRad(ConfigFloat("Phase2.ShootAngleSpread"))+initialAngle;
BULLET_LIST.emplace_back(std::make_unique<Bullet>(m.GetPos(),vf2d{cos(angle),sin(angle)}*bulletSpd,6,ConfigInt("ProjectileDamage"),m.OnUpperLevel(),false,YELLOW,vf2d{6,6}));
}
}
if(m.I(A::PATTERN_REPEAT_COUNT)>ConfigInt("Phase2.ShootCount")){
m.I(A::PATTERN_REPEAT_COUNT)=0;
m.SetState(State::CASTING);
}
}break; }break;
case 3:{ case 3:{
if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){ if(m.hp<=m.maxhp*ConfigFloat("Phase4.Change")/100){

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

@ -74,6 +74,8 @@ MonsterStrategy
{ {
# The Slime King Boss script. # The Slime King Boss script.
Name = Slime King Name = Slime King
# Which phase to start on. Should be 1 most of the time.
StartPhase = 1
# How much time a jump will be pre-telegraphed. # How much time a jump will be pre-telegraphed.
JumpWarningIndicatorTime = 1.0 JumpWarningIndicatorTime = 1.0
# Distance to jump up into the sky. A higher value causes it to launch up and down seemingly faster. # Distance to jump up into the sky. A higher value causes it to launch up and down seemingly faster.

@ -139,6 +139,7 @@ Monsters
Size = 800 Size = 800
Strategy = Slime King Strategy = Slime King
StartPhase = 2
#Size of each animation frame #Size of each animation frame
SheetFrameSize = 24,24 SheetFrameSize = 24,24
@ -150,6 +151,6 @@ Monsters
DeathAnimation = 10, 0.1, OneShot DeathAnimation = 10, 0.1, OneShot
#Additional custom animations go down below. Start with ANIMATION[0] #Additional custom animations go down below. Start with ANIMATION[0]
#ANIMATION[0] = MY_NEW_ANIMATION ANIMATION[0] = monsters/Slime King - Cast.png
} }
} }

@ -35,4 +35,5 @@ Images
GFX_Splash_Effect = splash_effect.png GFX_Splash_Effect = splash_effect.png
GFX_Warrior_Sheet = nico-warrior.png GFX_Warrior_Sheet = nico-warrior.png
GFX_Wizard_Sheet = nico-wizard.png GFX_Wizard_Sheet = nico-wizard.png
GFX_SlimeKing_Cast = monsters/Slime King - Cast.png
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@ -8,6 +8,10 @@ vf2d util::pointTo(vf2d posFrom,vf2d posTo){
return geom2d::line(posFrom,posTo).vector().norm(); return geom2d::line(posFrom,posTo).vector().norm();
} }
float util::angleTo(vf2d posFrom,vf2d posTo){
return geom2d::line<float>(posFrom,posTo).vector().polar().y;
}
float util::degToRad(float deg){ float util::degToRad(float deg){
return deg*(PI/180); return deg*(PI/180);
} }

@ -6,6 +6,8 @@ namespace util{
float random(float range); float random(float range);
//Returns a normalized vector pointing from posFrom towards posTo. //Returns a normalized vector pointing from posFrom towards posTo.
vf2d pointTo(vf2d posFrom,vf2d posTo); vf2d pointTo(vf2d posFrom,vf2d posTo);
//Returns the angle (in radians) pointing from posFrom towards posTo.
float angleTo(vf2d posFrom,vf2d posTo);
float degToRad(float deg); float degToRad(float deg);
float radToDeg(float rad); float radToDeg(float rad);
float lerp(float n1,float n2,double t); float lerp(float n1,float n2,double t);

Loading…
Cancel
Save