Add bomb explosion sound effect. Fix bug with the player getting knocked back whenever a monster's proximity knockback function is called. Release Build 9247.
This commit is contained in:
parent
3f463bcf2f
commit
b2b1fa81cf
@ -40,6 +40,7 @@ All rights reserved.
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "AdventuresInLestoria.h"
|
#include "AdventuresInLestoria.h"
|
||||||
#include "BombBoom.h"
|
#include "BombBoom.h"
|
||||||
|
#include "SoundEffect.h"
|
||||||
|
|
||||||
INCLUDE_DATA
|
INCLUDE_DATA
|
||||||
INCLUDE_ANIMATION_DATA
|
INCLUDE_ANIMATION_DATA
|
||||||
@ -67,6 +68,7 @@ void Bomb::Update(float fElapsedTime){
|
|||||||
z=0; //Force the bomb to be grounded.
|
z=0; //Force the bomb to be grounded.
|
||||||
fadeOutTime=bombFadeoutTime;
|
fadeOutTime=bombFadeoutTime;
|
||||||
game->AddEffect(std::make_unique<BombBoom>(pos,0.f,OnUpperLevel(),vf2d{radius,radius}/12.f/1.5f/*Upscale 24x24 to 36x36*/,1.f,vf2d{},WHITE,0.f,0.f,true));
|
game->AddEffect(std::make_unique<BombBoom>(pos,0.f,OnUpperLevel(),vf2d{radius,radius}/12.f/1.5f/*Upscale 24x24 to 36x36*/,1.f,vf2d{},WHITE,0.f,0.f,true));
|
||||||
|
SoundEffect::PlaySFX("Bomb Explode",pos);
|
||||||
float distToPlayer=geom2d::line<float>(pos,game->GetPlayer()->GetPos()).length();
|
float distToPlayer=geom2d::line<float>(pos,game->GetPlayer()->GetPos()).length();
|
||||||
if(friendly){
|
if(friendly){
|
||||||
const MonsterHurtList hurtEnemies=game->HurtEnemies(pos,radius,damage,OnUpperLevel(),z);
|
const MonsterHurtList hurtEnemies=game->HurtEnemies(pos,radius,damage,OnUpperLevel(),z);
|
||||||
|
@ -979,11 +979,11 @@ void DeathSpawnInfo::Spawn(const vf2d monsterDeathPos,const bool onUpperLevel){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Monster::ProximityKnockback(const vf2d centerPoint,const float knockbackFactor){
|
void Monster::ProximityKnockback(const vf2d centerPoint,const float knockbackFactor){
|
||||||
geom2d::line<float>lineToMonster(centerPoint,game->GetPlayer()->GetPos());
|
geom2d::line<float>lineToMonster(centerPoint,GetPos());
|
||||||
float dist=lineToMonster.length();
|
float dist=lineToMonster.length();
|
||||||
if(dist<0.001f){
|
if(dist<0.001f){
|
||||||
float randomDir=util::random(2*PI);
|
float randomDir=util::random(2*PI);
|
||||||
lineToMonster={centerPoint,centerPoint+vf2d{cos(randomDir),sin(randomDir)}*1};
|
lineToMonster={centerPoint,centerPoint+vf2d{cos(randomDir),sin(randomDir)}*1};
|
||||||
}
|
}
|
||||||
game->GetPlayer()->Knockback(lineToMonster.vector().norm()*knockbackFactor);
|
Knockback(lineToMonster.vector().norm()*knockbackFactor);
|
||||||
}
|
}
|
@ -233,6 +233,7 @@ private:
|
|||||||
vf2d mountedSprOffset{};
|
vf2d mountedSprOffset{};
|
||||||
private:
|
private:
|
||||||
struct STRATEGY{
|
struct STRATEGY{
|
||||||
|
static std::string ERR;
|
||||||
static int _GetInt(Monster&m,std::string param,std::string strategy,int index=0);
|
static int _GetInt(Monster&m,std::string param,std::string strategy,int index=0);
|
||||||
static float _GetFloat(Monster&m,std::string param,std::string strategy,int index=0);
|
static float _GetFloat(Monster&m,std::string param,std::string strategy,int index=0);
|
||||||
static Pixel _GetPixel(Monster&m,std::string param,std::string strategy,int index=0);
|
static Pixel _GetPixel(Monster&m,std::string param,std::string strategy,int index=0);
|
||||||
|
@ -42,6 +42,8 @@ All rights reserved.
|
|||||||
INCLUDE_DATA
|
INCLUDE_DATA
|
||||||
INCLUDE_STRATEGY_DATA
|
INCLUDE_STRATEGY_DATA
|
||||||
|
|
||||||
|
std::string Monster::STRATEGY::ERR{};
|
||||||
|
|
||||||
void Monster::InitializeStrategies(){
|
void Monster::InitializeStrategies(){
|
||||||
STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS);
|
STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS);
|
||||||
STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR);
|
STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR);
|
||||||
@ -103,7 +105,7 @@ const std::string&Monster::STRATEGY::_GetString(Monster&m,std::string param,std:
|
|||||||
return DATA["MonsterStrategy"][strategy].GetProperty(param).GetString(index);
|
return DATA["MonsterStrategy"][strategy].GetProperty(param).GetString(index);
|
||||||
}else{
|
}else{
|
||||||
ERR(std::format("Monster {} trying to read non-existent String Property {}[{}] for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy))
|
ERR(std::format("Monster {} trying to read non-existent String Property {}[{}] for Strategy {}. THIS SHOULD NOT BE HAPPENING!",m.GetName(),param,index,strategy))
|
||||||
return{};
|
return ERR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vf2d Monster::STRATEGY::_GetVec(Monster&m,std::string param,std::string strategy,int index){
|
vf2d Monster::STRATEGY::_GetVec(Monster&m,std::string param,std::string strategy,int index){
|
||||||
@ -131,7 +133,7 @@ const datafile&Monster::STRATEGY::_Get(Monster&m,std::string param,std::string s
|
|||||||
return DATA["MonsterStrategy"][strategy].GetProperty(param);
|
return DATA["MonsterStrategy"][strategy].GetProperty(param);
|
||||||
}else{
|
}else{
|
||||||
ERR(std::format("Monster {} trying to read non-existent Data Property {} for Strategy {}",m.GetName(),param,strategy));
|
ERR(std::format("Monster {} trying to read non-existent Data Property {} for Strategy {}",m.GetName(),param,strategy));
|
||||||
return{};
|
return DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Pixel Monster::STRATEGY::_GetPixel(Monster&m,std::string param,std::string strategy,int index){
|
Pixel Monster::STRATEGY::_GetPixel(Monster&m,std::string param,std::string strategy,int index){
|
||||||
|
@ -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 9237
|
#define VERSION_BUILD 9247
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -13,6 +13,12 @@ Events
|
|||||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||||
File[0] = bear_slam.ogg, 70%
|
File[0] = bear_slam.ogg, 70%
|
||||||
}
|
}
|
||||||
|
Bomb Explode
|
||||||
|
{
|
||||||
|
CombatSound = True
|
||||||
|
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||||
|
File[0] = bomb_explosion.ogg, 100%
|
||||||
|
}
|
||||||
Button Click
|
Button Click
|
||||||
{
|
{
|
||||||
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
|
||||||
|
BIN
Adventures in Lestoria/assets/sounds/bomb_explosion.ogg
Normal file
BIN
Adventures in Lestoria/assets/sounds/bomb_explosion.ogg
Normal file
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user