Update Dagger Goblin template to use a distinct icon in maps. Change all monster tileset paths from maps/Monsters to maps/ (game requires all tilesets placed in there). Added slash behaviors for dagger-wielding goblins. Release Build 9037.

This commit is contained in:
sigonasr2 2024-04-24 00:47:16 -05:00
parent 6b6bdf741b
commit 00b18355c1
36 changed files with 178 additions and 40 deletions

View File

@ -658,6 +658,10 @@
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="DaggerSlash.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="DaggerStab.cpp">
<SubType>
</SubType>

View File

@ -235,6 +235,7 @@ void sig::Animation::InitializeAnimations(){
CreateHorizontalAnimationSequence("lightning_splash_effect.png",5,{24,24});
CreateHorizontalAnimationSequence("dagger_stab.png",2,{24,24},AnimationData{0.1f,Animate2D::Style::PingPong});
CreateHorizontalAnimationSequence("goblin_sword_slash.png",3,{24,24},{0.05f,Animate2D::Style::OneShot});
CreateStillAnimation("meteor.png",{192,192});

View File

@ -101,6 +101,11 @@ struct Wisp:public Bullet{
bool MonsterHit(Monster&monster)override;
};
enum class HorizontalFlip{
NONE,
FLIPPED,
};
struct DaggerStab:public Bullet{
struct DirectionOffsets{
std::unordered_map<Direction,vf2d>offsets;
@ -111,11 +116,6 @@ struct DaggerStab:public Bullet{
}
};
enum class HorizontalFlip{
NONE,
FLIPPED,
};
Monster&sourceMonster;
Direction facingDir;
float frameDuration;
@ -127,4 +127,18 @@ struct DaggerStab:public Bullet{
void Update(float fElapsedTime)override;
bool PlayerHit(Player*player)override;
bool MonsterHit(Monster&monster)override;
};
struct DaggerSlash:public Bullet{
Monster&sourceMonster;
Direction facingDir;
float frameDuration;
float daggerSlashDistance;
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,const HorizontalFlip horizontalFlip,bool friendly=false,Pixel col=WHITE);
void Update(float fElapsedTime)override;
bool PlayerHit(Player*player)override;
bool MonsterHit(Monster&monster)override;
};

View File

@ -0,0 +1,100 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "BulletTypes.h"
#include "SoundEffect.h"
#include "AdventuresInLestoria.h"
#include "DEFINES.h"
#include "util.h"
INCLUDE_game
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)
: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){}
void DaggerSlash::Update(float fElapsedTime){
ANIMATION_DATA["goblin_sword_slash.png"].ChangeFrameDuration(frameDuration);
pos=sourceMonster.GetPos();
#pragma region Dagger slash offset
switch(facingDir){
case Direction::NORTH:{
pos+=vf2d{0,-daggerSlashDistance};
}break;
case Direction::EAST:{
pos+=vf2d{daggerSlashDistance,0};
}break;
case Direction::SOUTH:{
pos+=vf2d{0,daggerSlashDistance};
}break;
case Direction::WEST:{
pos+=vf2d{-daggerSlashDistance,0};
}break;
default:ERR(std::format("WARNING! Unknown direction value {} was supplied! THIS SHOULD NOT BE HAPPENING!",int(facingDir)));
}
#pragma endregion
#pragma region Dagger rotation handling
switch(facingDir){
case Direction::NORTH:{
vel={0,-0.001f};
}break;
case Direction::EAST:{
vel={0.001f,0};
}break;
case Direction::SOUTH:{
vel={0,0.001f};
}break;
case Direction::WEST:{
vel={-0.001f,0};
}break;
default:ERR(std::format("WARNING! Unknown direction value {} was supplied! THIS SHOULD NOT BE HAPPENING!",int(facingDir)));
}
#pragma endregion
}
bool DaggerSlash::PlayerHit(Player*player){
deactivated=true;
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{}));
player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt);
return false;
}
bool DaggerSlash::MonsterHit(Monster&monster){
deactivated=true;
game->AddEffect(std::make_unique<Effect>(pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{}));
monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt);
return false;
}

View File

@ -40,6 +40,7 @@ All rights reserved.
#include "Monster.h"
#include "MonsterStrategyHelpers.h"
#include "BulletTypes.h"
#include "util.h"
/*
Attack Strategie:
Runs infront of player,
@ -86,13 +87,14 @@ void Monster::STRATEGY::GOBLIN_DAGGER(Monster&m,float fElapsedTime,std::string s
RUN_TOWARDS(m,fElapsedTime,"Run Towards");
}else{
m.phase=WINDUP;
m.I(A::ATTACK_TYPE)=STAB; //TODO: Choose randomly between stab or slash.
m.F(A::CASTING_TIMER)=ConfigFloat("Stab Windup Time");
m.I(A::ATTACK_TYPE)=util::random()%2; //Choose randomly between stab or slash.
switch(m.I(A::ATTACK_TYPE)){
case STAB:{
m.F(A::CASTING_TIMER)=ConfigFloat("Stab Windup Time");
SetFacingAnimation(STAB_WINDUP_ANIMATION,game->GetPlayer()->GetPos());
}break;
case SLASH:{
m.F(A::CASTING_TIMER)=ConfigFloat("Slash Windup Time");
SetFacingAnimation(SLASH_WINDUP_ANIMATION,game->GetPlayer()->GetPos());
}break;
default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE)));
@ -107,11 +109,13 @@ void Monster::STRATEGY::GOBLIN_DAGGER(Monster&m,float fElapsedTime,std::string s
case STAB:{
vf2d stabTarget=game->GetPlayer()->GetPos();
SetFacingAnimation(STAB_ANIMATION,stabTarget);
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"),IsSpriteFlipped()?DaggerStab::HorizontalFlip::FLIPPED:DaggerStab::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"),IsSpriteFlipped()?HorizontalFlip::FLIPPED:HorizontalFlip::NONE,
DaggerStab::DirectionOffsets{ConfigVec("Dagger Up Offset"),ConfigVec("Dagger Down Offset"),ConfigVec("Dagger Left Offset")})EndBullet;
}break;
case SLASH:{
SetFacingAnimation(SLASH_ANIMATION,game->GetPlayer()->GetPos());
vf2d slashTarget=game->GetPlayer()->GetPos();
SetFacingAnimation(SLASH_ANIMATION,slashTarget);
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"),IsSpriteFlipped()?HorizontalFlip::FLIPPED:HorizontalFlip::NONE)EndBullet;
}break;
default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE)));
}

View File

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

View File

@ -1,5 +1,5 @@
<?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="17">
<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="20">
<properties>
<property name="Backdrop" propertytype="Backdrop" value="None"/>
<property name="Background Music" propertytype="BGM" value="foresty1_1"/>
@ -9,6 +9,7 @@
<tileset firstgid="2913" source="../maps/End_of_Map.tsx"/>
<tileset firstgid="4513" source="../maps/objects.tsx"/>
<tileset firstgid="5296" source="../maps/Decorations_c1_No_Shadow24x24.tsx"/>
<tileset firstgid="6916" source="../maps/Monsters.tsx"/>
<layer id="1" name="Layer 1" width="238" height="369">
<data encoding="csv">
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
@ -1878,11 +1879,6 @@
<object id="1" name="Player Spawn" type="PlayerSpawnLocation" x="5112" y="8064" width="24" height="24"/>
<object id="2" name="Time Trial Clock" type="TrialClock" x="5112" y="8016" width="24" height="24"/>
<object id="5" name="End Ring" type="EndZone" x="3349" y="165" width="145" height="145"/>
<object id="7" template="../maps/Monsters/Boar.tx" x="4764" y="8049">
<properties>
<property name="spawner" type="object" value="15"/>
</properties>
</object>
<object id="15" name="Spawn Group 1" type="SpawnGroup" x="4439" y="7869" width="496" height="424">
<ellipse/>
</object>
@ -1891,5 +1887,15 @@
<property name="spawner" type="object" value="15"/>
</properties>
</object>
<object id="18" template="../maps/Monsters/Goblin (Dagger).tx" x="4711" y="8032">
<properties>
<property name="spawner" type="object" value="15"/>
</properties>
</object>
<object id="19" template="../maps/Monsters/Goblin (Dagger).tx" x="4646" y="8027">
<properties>
<property name="spawner" type="object" value="15"/>
</properties>
</object>
</objectgroup>
</map>

View File

@ -574,6 +574,14 @@ MonsterStrategy
# How long between each dagger stab frame.
Dagger Frame Duration = 0.1s
# Slash Attack windup time
Slash Windup Time = 0.4s
# Number of pixels of reach the dagger slash has from the monster.
Dagger Slash Distance = 6
Dagger Slash Knockback = 75
# 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 = 6,-5

View File

@ -87,6 +87,7 @@ Images
GFX_Vignette = vignette.png
GFX_Checkmark = checkmark.png
GFX_DaggerStab = dagger_stab.png
GFX_GoblinSwordSlash = goblin_sword_slash.png
# Ability Icons
GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="24" tileheight="24" infinite="1" nextlayerid="3" nextobjectid="19">
<tileset firstgid="1" source="Monsters/Monsters.tsx"/>
<map version="1.10" tiledversion="1.10.2" orientation="orthogonal" renderorder="right-down" width="30" height="20" tilewidth="24" tileheight="24" infinite="1" nextlayerid="3" nextobjectid="23">
<tileset firstgid="1" source="Monsters.tsx"/>
<layer id="1" name="Tile Layer 1" width="30" height="20">
<data encoding="csv"/>
</layer>
@ -17,11 +17,11 @@
<object id="10" template="Monsters/Slime King.tx" type="Monster" x="-193" y="97"/>
<object id="11" template="Monsters/Ursule, Mother of Bears.tx" type="Monster" x="-220" y="266"/>
<object id="12" template="Monsters/Boar.tx" type="Monster" x="38" y="171"/>
<object id="13" template="Monsters/Goblin (Dagger).tx" type="Monster" x="39" y="217" width="21.6" height="21.6"/>
<object id="14" template="Monsters/Goblin (Bow).tx" type="Monster" x="89" y="220"/>
<object id="15" template="Monsters/Goblin (Bombs).tx" type="Monster" x="131" y="222"/>
<object id="14" template="Monsters/Goblin (Bow).tx" type="Monster" x="89" y="213"/>
<object id="15" template="Monsters/Goblin (Bombs).tx" type="Monster" x="133" y="216"/>
<object id="16" template="Monsters/Goblin Boar Rider.tx" type="Monster" x="111" y="171"/>
<object id="17" template="Monsters/Hawk.tx" type="Monster" x="102" y="109" width="12" height="12"/>
<object id="18" template="Monsters/Stone Elemental.tx" type="Monster" x="169" y="175"/>
<object id="22" template="Monsters/Goblin (Dagger).tx" type="Monster" x="39" y="211"/>
</objectgroup>
</map>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Bear" type="Monster" gid="1" width="48" height="48"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Blue Slime" type="Monster" gid="2" width="24" height="24"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Boar" type="Monster" gid="15" width="26.4" height="26.4"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Bun" type="Monster" gid="3" width="48" height="48"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Flower Turret" type="Monster" gid="4" width="24" height="24"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Frog" type="Monster" gid="5" width="16.8" height="16.8"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Goblin (Bombs)" type="Monster" gid="13" width="21.6" height="21.6"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Goblin (Bow)" type="Monster" gid="13" width="21.6" height="21.6"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<object name="Goblin (Dagger)" type="Monster" gid="13" width="24" height="24"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Goblin (Dagger)" type="Monster" gid="17" width="24" height="24"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Goblin Boar Rider" type="Monster" gid="14" width="24" height="24"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Green Slime" type="Monster" gid="6" width="19.2" height="19.2"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Hawk" type="Monster" gid="12" width="24" height="24"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Red Slime" type="Monster" gid="7" width="28.8" height="28.8"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Slime King" type="Monster" gid="8" width="192" height="192"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Stone Elemental" type="Monster" gid="16" width="52.8" height="52.8"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Ursule, Mother of Bears" type="Monster" gid="9" width="192" height="192"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Windhound" type="Monster" gid="10" width="21.6" height="21.6"/>
</template>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<template>
<tileset firstgid="1" source="Monsters.tsx"/>
<tileset firstgid="1" source="../Monsters.tsx"/>
<object name="Yellow Slime" type="Monster" gid="11" width="38.4" height="38.4"/>
</template>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 12 KiB