Change goblin dagger stab to match new sprite positions and modify animation speeds slightly. Release Build 9180.

mac-build
sigonasr2 7 months ago
parent ef53d9852a
commit 17581cfaf4
  1. 11
      Adventures in Lestoria/BulletTypes.h
  2. 4
      Adventures in Lestoria/DaggerSlash.cpp
  3. 5
      Adventures in Lestoria/DaggerStab.cpp
  4. 15
      Adventures in Lestoria/Goblin_Dagger.cpp
  5. 2
      Adventures in Lestoria/Version.h
  6. 10
      Adventures in Lestoria/assets/Campaigns/2_1.tmx
  7. 8
      Adventures in Lestoria/assets/config/MonsterStrategies.txt
  8. 2
      Adventures in Lestoria/assets/config/Monsters.txt
  9. BIN
      Adventures in Lestoria/assets/dagger_stab.png
  10. BIN
      Adventures in Lestoria/assets/gamepack.pak
  11. BIN
      x64/Release/Adventures in Lestoria.exe

@ -114,10 +114,11 @@ enum class HorizontalFlip{
struct DaggerStab:public Bullet{ struct DaggerStab:public Bullet{
struct DirectionOffsets{ struct DirectionOffsets{
std::unordered_map<Direction,vf2d>offsets; std::unordered_map<Direction,vf2d>offsets;
DirectionOffsets(const vf2d upOffset,const vf2d downOffset,const vf2d leftOffset){ DirectionOffsets(const vf2d upOffset,const vf2d downOffset,const vf2d rightOffset,const vf2d leftOffset){
offsets[Direction::NORTH]=upOffset; offsets[Direction::NORTH]=upOffset;
offsets[Direction::SOUTH]=downOffset; offsets[Direction::SOUTH]=downOffset;
offsets[Direction::EAST]=offsets[Direction::WEST]=leftOffset; //Both east and west use one offset because the sprite flipping system will handle flipping the position of the dagger for the other side. offsets[Direction::EAST]=rightOffset;
offsets[Direction::WEST]=leftOffset;
} }
}; };
@ -127,8 +128,7 @@ struct DaggerStab:public Bullet{
float daggerStabDistance; float daggerStabDistance;
float knockbackAmt; float knockbackAmt;
DirectionOffsets daggerPositionOffsets; DirectionOffsets daggerPositionOffsets;
HorizontalFlip horizontalFlip; DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const DirectionOffsets offsets,bool friendly=false,Pixel col=WHITE);
DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const HorizontalFlip horizontalFlip,const DirectionOffsets offsets,bool friendly=false,Pixel col=WHITE);
void Update(float fElapsedTime)override; void Update(float fElapsedTime)override;
bool PlayerHit(Player*player)override; bool PlayerHit(Player*player)override;
bool MonsterHit(Monster&monster)override; bool MonsterHit(Monster&monster)override;
@ -141,8 +141,7 @@ struct DaggerSlash:public Bullet{
float frameDuration; float frameDuration;
float daggerSlashDistance; float daggerSlashDistance;
float knockbackAmt; float knockbackAmt;
HorizontalFlip horizontalFlip; DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,bool friendly=false,Pixel col=WHITE);
DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,const HorizontalFlip horizontalFlip,bool friendly=false,Pixel col=WHITE);
void Update(float fElapsedTime)override; void Update(float fElapsedTime)override;
bool PlayerHit(Player*player)override; bool PlayerHit(Player*player)override;
bool MonsterHit(Monster&monster)override; bool MonsterHit(Monster&monster)override;

@ -45,9 +45,9 @@ All rights reserved.
INCLUDE_game INCLUDE_game
INCLUDE_ANIMATION_DATA INCLUDE_ANIMATION_DATA
DaggerSlash::DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,const HorizontalFlip horizontalFlip,bool friendly,Pixel col) DaggerSlash::DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,bool friendly,Pixel col)
:Bullet(sourceMonster.GetPos(),{},radius,damage,"goblin_sword_slash.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["goblin_sword_slash.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col), :Bullet(sourceMonster.GetPos(),{},radius,damage,"goblin_sword_slash.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["goblin_sword_slash.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerSlashDistance(daggerSlashDistance),facingDir(facingDir),horizontalFlip(horizontalFlip),knockbackAmt(knockbackAmt){} sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerSlashDistance(daggerSlashDistance),facingDir(facingDir),knockbackAmt(knockbackAmt){}
void DaggerSlash::Update(float fElapsedTime){ void DaggerSlash::Update(float fElapsedTime){
ANIMATION_DATA["goblin_sword_slash.png"].ChangeFrameDuration(frameDuration); ANIMATION_DATA["goblin_sword_slash.png"].ChangeFrameDuration(frameDuration);
pos=sourceMonster.GetPos(); pos=sourceMonster.GetPos();

@ -45,14 +45,13 @@ All rights reserved.
INCLUDE_game INCLUDE_game
INCLUDE_ANIMATION_DATA INCLUDE_ANIMATION_DATA
DaggerStab::DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const HorizontalFlip horizontalFlip,const DirectionOffsets offsets,bool friendly,Pixel col) DaggerStab::DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const DirectionOffsets offsets,bool friendly,Pixel col)
:Bullet(sourceMonster.GetPos(),{},radius,damage,"dagger_stab.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["dagger_stab.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col), :Bullet(sourceMonster.GetPos(),{},radius,damage,"dagger_stab.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["dagger_stab.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerStabDistance(daggerStabDistance),facingDir(facingDir),daggerPositionOffsets(offsets),horizontalFlip(horizontalFlip),knockbackAmt(knockbackAmt){} sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerStabDistance(daggerStabDistance),facingDir(facingDir),daggerPositionOffsets(offsets),knockbackAmt(knockbackAmt){}
void DaggerStab::Update(float fElapsedTime){ void DaggerStab::Update(float fElapsedTime){
ANIMATION_DATA["dagger_stab.png"].ChangeFrameDuration(frameDuration); ANIMATION_DATA["dagger_stab.png"].ChangeFrameDuration(frameDuration);
#pragma region Dagger Position Offset #pragma region Dagger Position Offset
vf2d daggerOffset=daggerPositionOffsets.offsets[facingDir]; vf2d daggerOffset=daggerPositionOffsets.offsets[facingDir];
if(horizontalFlip==HorizontalFlip::FLIPPED)daggerOffset.x*=-1;
pos=sourceMonster.GetPos()+daggerOffset; pos=sourceMonster.GetPos()+daggerOffset;
#pragma endregion #pragma endregion
#pragma region Dagger stabbing #pragma region Dagger stabbing

@ -66,15 +66,6 @@ void Monster::STRATEGY::GOBLIN_DAGGER(Monster&m,float fElapsedTime,std::string s
SLASH SLASH
}; };
enum class ANIMATION_OFFSET{
STAB_WINDUP_ANIMATION=0,
STAB_ANIMATION=4,
SLASH_WINDUP_ANIMATION=8,
SLASH_ANIMATION=12,
IDLE_ANIMATION=16,
};
using enum ANIMATION_OFFSET;
switch(m.phase){ switch(m.phase){
case MOVE:{ case MOVE:{
float distToPlayer=m.GetDistanceFrom(game->GetPlayer()->GetPos()); float distToPlayer=m.GetDistanceFrom(game->GetPlayer()->GetPos());
@ -104,13 +95,13 @@ void Monster::STRATEGY::GOBLIN_DAGGER(Monster&m,float fElapsedTime,std::string s
case STAB:{ case STAB:{
vf2d stabTarget=game->GetPlayer()->GetPos(); vf2d stabTarget=game->GetPlayer()->GetPos();
m.PerformAnimation("STABBING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); m.PerformAnimation("STABBING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
CreateBullet(DaggerStab)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Stab Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(stabTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Stab Distance"),HorizontalFlip::NONE, CreateBullet(DaggerStab)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Stab Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(stabTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Stab Distance"),
DaggerStab::DirectionOffsets{ConfigVec("Dagger Up Offset"),ConfigVec("Dagger Down Offset"),ConfigVec("Dagger Left Offset")})EndBullet; DaggerStab::DirectionOffsets{ConfigVec("Dagger Up Offset"),ConfigVec("Dagger Down Offset"),ConfigVec("Dagger Right Offset"),ConfigVec("Dagger Left Offset")})EndBullet;
}break; }break;
case SLASH:{ case SLASH:{
vf2d slashTarget=game->GetPlayer()->GetPos(); vf2d slashTarget=game->GetPlayer()->GetPos();
m.PerformAnimation("SLASHING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); m.PerformAnimation("SLASHING",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos()));
CreateBullet(DaggerSlash)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Slash Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(slashTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Slash Distance"),HorizontalFlip::NONE)EndBullet; CreateBullet(DaggerSlash)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Slash Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(slashTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Slash Distance"))EndBullet;
}break; }break;
default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE))); default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE)));
} }

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

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="238" height="369" tilewidth="24" tileheight="24" infinite="0" nextlayerid="7" nextobjectid="30"> <map version="1.10" tiledversion="1.10.2" class="Map" orientation="orthogonal" renderorder="right-down" width="238" height="369" tilewidth="24" tileheight="24" infinite="0" nextlayerid="7" nextobjectid="33">
<properties> <properties>
<property name="Backdrop" propertytype="Backdrop" value="mountain_day"/> <property name="Backdrop" propertytype="Backdrop" value="mountain_day"/>
<property name="Background Music" propertytype="BGM" value="foresty1_1"/> <property name="Background Music" propertytype="BGM" value="foresty1_1"/>
@ -1881,18 +1881,18 @@
<object id="15" name="Spawn Group 1" type="SpawnGroup" x="4439" y="7869" width="496" height="424"> <object id="15" name="Spawn Group 1" type="SpawnGroup" x="4439" y="7869" width="496" height="424">
<ellipse/> <ellipse/>
</object> </object>
<object id="27" template="../maps/Monsters/Goblin (Bow).tx" x="4567" y="8001"> <object id="28" name="Player Spawn" type="PlayerSpawnLocation" x="5112" y="8064" width="24" height="24"/>
<object id="30" template="../maps/Monsters/Goblin (Dagger).tx" x="4466" y="8088">
<properties> <properties>
<property name="spawner" type="object" value="15"/> <property name="spawner" type="object" value="15"/>
</properties> </properties>
</object> </object>
<object id="28" name="Player Spawn" type="PlayerSpawnLocation" x="5112" y="8064" width="24" height="24"/> <object id="31" template="../maps/Monsters/Goblin (Dagger).tx" x="4785" y="7901">
<object id="28" template="../maps/Monsters/Goblin (Bow).tx" x="4472" y="8175">
<properties> <properties>
<property name="spawner" type="object" value="15"/> <property name="spawner" type="object" value="15"/>
</properties> </properties>
</object> </object>
<object id="29" template="../maps/Monsters/Goblin (Bow).tx" x="4815" y="7821"> <object id="32" template="../maps/Monsters/Goblin (Dagger).tx" x="4565" y="7976">
<properties> <properties>
<property name="spawner" type="object" value="15"/> <property name="spawner" type="object" value="15"/>
</properties> </properties>

@ -583,10 +583,10 @@ MonsterStrategy
Dagger Slash Knockback = 75 Dagger Slash Knockback = 75
# Offset for the dagger stab effect per direction from the monster's center. # Offset for the dagger stab effect per direction from the monster's center.
# NOTE: Right is missing because left and right get mirrored by the game engine. Dagger Up Offset = 5,-4
Dagger Up Offset = 6,-5 Dagger Down Offset = -5,5
Dagger Down Offset = -5,11 Dagger Right Offset = 4,4
Dagger Left Offset = -10,6 Dagger Left Offset = -2,4
} }
Goblin Bow Goblin Bow
{ {

@ -548,7 +548,7 @@ Monsters
# Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse)
# Animations must be defined in the same order as they are in their sprite sheets # Animations must be defined in the same order as they are in their sprite sheets
# The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator. # The First Four animations must represent a standing, walking, attack, and death animation. Their names are up to the creator.
IDLE = 2, 0.1, Repeat IDLE = 2, 0.6, Repeat
WALK = 4, 0.15, Repeat WALK = 4, 0.15, Repeat
STABBING = 4, 0.075, OneShot STABBING = 4, 0.075, OneShot
DEATH = 4, 0.15, OneShot DEATH = 4, 0.15, OneShot

Binary file not shown.

Before

Width:  |  Height:  |  Size: 712 B

After

Width:  |  Height:  |  Size: 4.3 KiB

Loading…
Cancel
Save