Frog tongue should only hit each entity one time.

pull/30/head
sigonasr2 11 months ago
parent 20e452b337
commit b97afb24bd
  1. 2
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 2
      Adventures in Lestoria/Bullet.h
  3. 10
      Adventures in Lestoria/FrogTongue.cpp
  4. 2
      Adventures in Lestoria/Version.h
  5. BIN
      x64/Release/Adventures in Lestoria.exe

@ -614,7 +614,7 @@ void AiL::UpdateBullets(float fElapsedTime){
return false;
}
}
b->hitList[&m]=true;
b->hitList.insert(&m);
}
}
}

@ -67,7 +67,7 @@ private:
public:
Animate2D::Animation<std::string>animation;
Animate2D::AnimationState internal_animState;
std::map<Monster*,bool>hitList;
std::set<Monster*>hitList;
virtual ~Bullet()=default;
Bullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1});
//Initializes a bullet with an animation.

@ -63,20 +63,22 @@ void FrogTongue::Update(float fElapsedTime){
}
if(friendly){
for(Monster&m:MONSTER_LIST){
if(geom2d::overlaps(m.Hitbox(),tongueLine)){
if(hitList.find(&m)==hitList.end()&&geom2d::overlaps(m.Hitbox(),tongueLine)){
MonsterHit(m);
hitList.insert(&m);
}
}
}
}
bool FrogTongue::PlayerHit(Player*player){
player->Hurt(damage,OnUpperLevel(),0);
deactivated=true;
if(!deactivated){
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(){

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

Loading…
Cancel
Save