diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 3b252359..65b81d7e 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -564,6 +564,10 @@ + + + + @@ -704,6 +708,7 @@ + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 8a4e4d8a..86bc0026 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -713,6 +713,9 @@ Source Files + + Source Files\Bullet Types + @@ -846,6 +849,9 @@ Configurations\GFX + + Documentation\Mechanics + diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 5c2c7d87..6b06fe87 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -606,7 +606,7 @@ void AiL::UpdateBullets(float fElapsedTime){ const auto CollisionCheck=[&](){ if(b->friendly){ for(Monster&m:MONSTER_LIST){ - if(geom2d::overlaps(geom2d::circle(m.GetPos(),12*m.GetSizeMult()),geom2d::circle(b->pos,b->radius))){ + if(geom2d::overlaps(m.Hitbox(),geom2d::circle(b->pos,b->radius))){ if(b->hitList.find(&m)==b->hitList.end()&&m.Hurt(b->damage,b->OnUpperLevel(),0)){ if(!b->hitsMultiple){ if(b->MonsterHit(m)){ @@ -619,7 +619,7 @@ void AiL::UpdateBullets(float fElapsedTime){ } } } else { - if(geom2d::overlaps(geom2d::circle(player->GetPos(),12*player->GetSizeMult()/2),geom2d::circle(b->pos,b->radius))){ + if(geom2d::overlaps(player->Hitbox(),geom2d::circle(b->pos,b->radius))){ if(player->Hurt(b->damage,b->OnUpperLevel(),0)){ if(b->PlayerHit(player.get())){ b->dead=true; @@ -804,7 +804,6 @@ void AiL::RenderWorld(float fElapsedTime){ if(player->teleportAnimationTimer>0){ playerScale.x=120*float(abs(pow(player->teleportAnimationTimer-"Wizard.Right Click Ability.AnimationTime"_F/2,3))); pos=player->teleportStartPosition.lerp(player->teleportTarget,("Wizard.Right Click Ability.AnimationTime"_F-player->teleportAnimationTimer)/"Wizard.Right Click Ability.AnimationTime"_F); - std::cout<attackBuffs=player->GetStatBuffs({"Attack","Attack %"}); view.DrawPartialRotatedDecal(pos+vf2d{0,-player->GetZ()*(std::signbit(scale.y)?-1:1)},player->GetFrame().GetSourceImage()->Decal(),player->GetSpinAngle(),{12,12},player->GetFrame().GetSourceRect().pos,player->GetFrame().GetSourceRect().size,playerScale*scale,attackBuffs.size()>0?Pixel{255,uint8_t(255*abs(sin(1.4*attackBuffs[0].duration))),uint8_t(255*abs(sin(1.4*attackBuffs[0].duration)))}:WHITE); diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 38f1a994..f57be5bf 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -56,6 +56,9 @@ All rights reserved. #include "olcPGEX_SplashScreen.h" #include "olcPixelGameEngine.h" +#define CreateBullet(type) BULLET_LIST.push_back(std::make_unique(type +#define EndBullet )); + class AiL : public olc::PixelGameEngine { friend class GameState; diff --git a/Adventures in Lestoria/BulletTypes.h b/Adventures in Lestoria/BulletTypes.h index 00a11075..ba0764af 100644 --- a/Adventures in Lestoria/BulletTypes.h +++ b/Adventures in Lestoria/BulletTypes.h @@ -78,4 +78,16 @@ struct ChargedArrow:public Bullet{ void Update(float fElapsedTime)override; bool PlayerHit(Player*player)override; bool MonsterHit(Monster&monster)override; +}; + +struct FrogTongue:public Bullet{ + vf2d targetPos; + float tongueLength; + float tongueSpd; + float duration; + FrogTongue(vf2d pos,vf2d targetPos,float lifetime,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE); + void Update(float fElapsedTime)override; + bool PlayerHit(Player*player)override; + bool MonsterHit(Monster&monster)override; + void Draw()override; }; \ No newline at end of file diff --git a/Adventures in Lestoria/Chapter_1_Creatures_Part_2.txt b/Adventures in Lestoria/Chapter_1_Creatures_Part_2.txt new file mode 100644 index 00000000..098a10e9 --- /dev/null +++ b/Adventures in Lestoria/Chapter_1_Creatures_Part_2.txt @@ -0,0 +1,23 @@ +Wolf +HP: 110 +Atk: 12 +Move-Spd: 120% +Size: 90% +Strategie: Runs Towards Player, in 400 range it locks on current player position and charges that position with additional 15% move speed. +After Attack 1 second not doing anything. +After that move speed increases by 30% and it disengages on an 800 range where it circles around the player for 3 seconds. after that time move speed resets to normal and it attacks again. + +Bear +HP: 210 +Atk: 45 +Move-Spd: 60% +Size: 200% +Strategie: Moves towards player. Once next to the Player character builds itself up and smashes the ground infront of him. 2 seconds time to dodge attack once it locks the area its attacking. + +Frog +HP: 60 +Atk: 15 +Move-Spd: 70% +Size: 70% +Strategie: Moves with small jumps. if range to player is 350 or lower locks on to player and keep facing its direction without moving for the next 1.5 seconds it will attack the position the player was last in this time frame with another 1 seconds delay. Tongue max range: 450 +after attack 0.5 seconds doing nothing then starts again closing the gap or prepares for an attack again depending if range is bigger then 350 again. \ No newline at end of file diff --git a/Adventures in Lestoria/FrogTongue.cpp b/Adventures in Lestoria/FrogTongue.cpp new file mode 100644 index 00000000..f20515b6 --- /dev/null +++ b/Adventures in Lestoria/FrogTongue.cpp @@ -0,0 +1,86 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +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 © 2023 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion + +#include "BulletTypes.h" +#include "AdventuresInLestoria.h" +#include "util.h" + +INCLUDE_game +INCLUDE_MONSTER_LIST +INCLUDE_GFX + +FrogTongue::FrogTongue(vf2d pos,vf2d targetPos,float lifetime,int damage,bool upperLevel,bool friendly,Pixel col) + :Bullet(pos,{},0,damage,upperLevel,friendly,col),targetPos(targetPos),tongueSpd(tongueSpd),tongueLength(0.f){ + this->lifetime=lifetime; + duration=lifetime; +} +void FrogTongue::Update(float fElapsedTime){ + geom2d::linelineToTarget(pos,targetPos); + + tongueLength=util::lerp(0,lineToTarget.length(),sin((lifetime*PI)/duration)); + + if(!friendly&&geom2d::overlaps(game->GetPlayer()->Hitbox(),lineToTarget)){ + PlayerHit(game->GetPlayer()); + } + if(friendly){ + for(Monster&m:MONSTER_LIST){ + if(geom2d::overlaps(m.Hitbox(),lineToTarget)){ + MonsterHit(m); + } + } + } +} +bool FrogTongue::PlayerHit(Player*player){ + player->Hurt(damage,OnUpperLevel(),0); + deactivated=true; + return false; +} +bool FrogTongue::MonsterHit(Monster&monster){ + monster.Hurt(damage,OnUpperLevel(),0); + deactivated=true; + return false; +} +void FrogTongue::Draw(){ + geom2d::linelineToTarget(pos,targetPos); + vf2d drawVec=lineToTarget.vector().norm()*3; + + vf2d tongueEndPos=geom2d::line(pos+drawVec,targetPos).upoint(sin((lifetime*PI)/duration)); + + game->view.DrawRotatedDecal(pos+drawVec,GFX["tongue.png"].Decal(),drawVec.polar().y,{0.f,1.f},{tongueLength,1.0f},col); + game->view.DrawRotatedDecal(tongueEndPos,GFX["tongue_end.png"].Decal(),drawVec.polar().y,{2.f,2.f},{1.f,1.f},col); +} \ No newline at end of file diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 5b93d57e..a8b95e77 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -583,4 +583,8 @@ const EventName&Monster::GetDeathSound(){ } const EventName&Monster::GetWalkSound(){ return MONSTER_DATA[name].GetWalkSound(); +} + +geom2d::circleMonster::Hitbox(){ + return {GetPos(),12*GetSizeMult()}; } \ No newline at end of file diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index d0b79a59..e5a29150 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -163,6 +163,7 @@ public: void SetZ(float z); const std::function&GetStrategy()const; void SetSize(float newSize,bool immediate=true); + geom2d::circleHitbox(); void SetStrategyDrawFunction(std::functionfunc); std::functionstrategyDraw=[](AiL*pge){}; const ItemAttributable&GetStats()const; diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 6b8ee582..9c51a53a 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -537,6 +537,10 @@ void Player::Update(float fElapsedTime){ } } + if(game->GetKey(G).bPressed){ + CreateBullet(FrogTongue)(GetPos(),game->GetWorldMousePos(),1.f,10,OnUpperLevel(),true,RED)EndBullet; + } + #pragma region Warrior switch(GetState()){ case State::SWING_SWORD:{ @@ -1215,4 +1219,8 @@ const float Player::GetAttackRecoveryRateReduction()const{ void EntityStats::Reset(){ equipStats.clear(); baseStats.clear(); +} + +geom2d::circlePlayer::Hitbox(){ + return {GetPos(),12*GetSizeMult()/2}; } \ No newline at end of file diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 0f322ec1..ba38e0f3 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -200,6 +200,8 @@ public: virtual std::string&GetIdleSAnimation()=0; virtual std::string&GetIdleWAnimation()=0; + geom2d::circleHitbox(); + void CheckEndZoneCollision(); CastInfo&GetCastInfo(); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index f33202d1..ddcbae38 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5724 +#define VERSION_BUILD 5735 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Wizard.cpp b/Adventures in Lestoria/Wizard.cpp index 6871e26b..7f1db84b 100644 --- a/Adventures in Lestoria/Wizard.cpp +++ b/Adventures in Lestoria/Wizard.cpp @@ -136,7 +136,6 @@ void Wizard::InitializeClassAbilities(){ p->teleportAnimationTimer="Wizard.Right Click Ability.AnimationTime"_F; p->teleportTarget=teleportPoint; p->teleportStartPosition=p->GetPos(); - std::cout<<"Start Position: "<<(p->teleportStartPosition)<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(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,"circle.png",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)); @@ -153,7 +152,7 @@ void Wizard::InitializeClassAbilities(){ Wizard::ability1.action= [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); - BULLET_LIST.push_back(std::make_unique(FireBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F},"Wizard.Ability 1.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 1.InitialDamageMult"_F),p->upperLevel,true,"Wizard.Ability 1.BulletColor"_Pixel))); + CreateBullet(FireBolt)(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 1.BulletSpeed"_F},"Wizard.Ability 1.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 1.InitialDamageMult"_F),p->upperLevel,true,"Wizard.Ability 1.BulletColor"_Pixel)EndBullet; SoundEffect::PlaySFX("Wizard Fire Bolt Shoot",SoundEffect::CENTERED); return true; }; @@ -162,7 +161,7 @@ void Wizard::InitializeClassAbilities(){ Wizard::ability2.action= [](Player*p,vf2d pos={}){ float angleToCursor=atan2(game->GetWorldMousePos().y-p->GetPos().y,game->GetWorldMousePos().x-p->GetPos().x); - BULLET_LIST.push_back(std::make_unique(LightningBolt(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F},"Wizard.Ability 2.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 2.DamageMult"_F),p->upperLevel,true,"Wizard.Ability 2.BulletColor"_Pixel))); + CreateBullet(LightningBolt)(p->GetPos(),{cos(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F,sin(angleToCursor)*"Wizard.Ability 2.BulletSpeed"_F},"Wizard.Ability 2.Radius"_F/100*12,int(p->GetAttack()*"Wizard.Ability 2.DamageMult"_F),p->upperLevel,true,"Wizard.Ability 2.BulletColor"_Pixel)EndBullet; SoundEffect::PlaySFX("Wizard Lightning Bolt Shoot",SoundEffect::CENTERED); return true; }; diff --git a/Adventures in Lestoria/assets/Campaigns/1_2.tmx b/Adventures in Lestoria/assets/Campaigns/1_2.tmx index a20a8771..65c336a8 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_2.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_2.tmx @@ -1,5 +1,5 @@ - + @@ -1218,4 +1218,12 @@ + + + + + + + + diff --git a/Adventures in Lestoria/assets/Campaigns/1_5.tmx b/Adventures in Lestoria/assets/Campaigns/1_5.tmx index 935b803f..9fd07eaf 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_5.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_5.tmx @@ -1,5 +1,5 @@ - + @@ -1109,4 +1109,12 @@ + + + + + + + + diff --git a/Adventures in Lestoria/assets/Campaigns/1_7.tmx b/Adventures in Lestoria/assets/Campaigns/1_7.tmx index 538b555f..56dd2031 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_7.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_7.tmx @@ -1,5 +1,5 @@ - + @@ -685,4 +685,12 @@ + + + + + + + + diff --git a/Adventures in Lestoria/assets/config/Monsters.txt b/Adventures in Lestoria/assets/config/Monsters.txt index 8d541ea8..1d0e01e2 100644 --- a/Adventures in Lestoria/assets/config/Monsters.txt +++ b/Adventures in Lestoria/assets/config/Monsters.txt @@ -260,14 +260,16 @@ Monsters #Size of each animation frame SheetFrameSize = 24,24 + # Tongue shoots from (9,13) + # Frame Count, Frame Speed (s), Frame Cycling (Repeat,OneShot,PingPong,Reverse) - IdleAnimation = 3, 0.2, PingPong - JumpAnimation = 4, 0.06, PingPong - ShootAnimation = 10, 0.1, OneShot - DeathAnimation = 4, 0.1, OneShot + IdleAnimation = 4, 0.13, PingPong + JumpAnimation = 10, 0.06, Repeat + ShootAnimation = 6, 0.15, PingPong + DeathAnimation = 6, 0.1, OneShot # Drop Item Name, Drop Percentage(0-100%), Drop Min Quantity, Drop Max Quantity - DROP[0] = Wolf Skin,35%,1,2 + DROP[0] = Frog Skin,35%,1,2 Hurt Sound = Monster Hurt Death Sound = Slime Dead diff --git a/Adventures in Lestoria/assets/config/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index 4150236d..6e64e44e 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -47,6 +47,8 @@ Images GFX_Pixel = pixel.png GFX_Title = title_transparent.png GFX_TitleBack = title_back.png + GFX_FrogTongue = tongue.png + GFX_FrogTongueEnd = tongue_end.png # Ability Icons GFX_Warrior_BattleCry_Icon = Ability Icons/battlecry.png diff --git a/Adventures in Lestoria/assets/items/Frog Skin.png b/Adventures in Lestoria/assets/items/Frog Skin.png index 57d8e4de..7ef6e8de 100644 Binary files a/Adventures in Lestoria/assets/items/Frog Skin.png and b/Adventures in Lestoria/assets/items/Frog Skin.png differ diff --git a/Adventures in Lestoria/assets/monsters/Frog.png b/Adventures in Lestoria/assets/monsters/Frog.png index 8384ce5a..5a5d27cc 100644 Binary files a/Adventures in Lestoria/assets/monsters/Frog.png and b/Adventures in Lestoria/assets/monsters/Frog.png differ diff --git a/Adventures in Lestoria/assets/tongue.png b/Adventures in Lestoria/assets/tongue.png new file mode 100644 index 00000000..521738f9 Binary files /dev/null and b/Adventures in Lestoria/assets/tongue.png differ diff --git a/Adventures in Lestoria/assets/tongue_end.png b/Adventures in Lestoria/assets/tongue_end.png new file mode 100644 index 00000000..e4af0b23 Binary files /dev/null and b/Adventures in Lestoria/assets/tongue_end.png differ diff --git a/Adventures in Lestoria/olcUTIL_Geometry2D.h b/Adventures in Lestoria/olcUTIL_Geometry2D.h index 7b23f534..b7fdcccb 100644 --- a/Adventures in Lestoria/olcUTIL_Geometry2D.h +++ b/Adventures in Lestoria/olcUTIL_Geometry2D.h @@ -311,12 +311,7 @@ namespace olc // Linearly interpolate between this vector, and another vector, given normalised parameter 't' inline constexpr v_2d lerp(const v_2d& v1, const double t) const { - return this->operator*(T(1.0 - t)) + (v1 * T(t)); - } - - inline constexpr v_2d operator * (const T& rhs) const - { - return v_2d(this->x * rhs, this->y * rhs); + return (*this) * (T(1.0 - t)) + (v1 * T(t)); } // Compare if this vector is numerically equal to another