Frog tongue should only hit each entity one time.
This commit is contained in:
parent
20e452b337
commit
b97afb24bd
@ -614,7 +614,7 @@ void AiL::UpdateBullets(float fElapsedTime){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
b->hitList[&m]=true;
|
b->hitList.insert(&m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
Animate2D::Animation<std::string>animation;
|
Animate2D::Animation<std::string>animation;
|
||||||
Animate2D::AnimationState internal_animState;
|
Animate2D::AnimationState internal_animState;
|
||||||
std::map<Monster*,bool>hitList;
|
std::set<Monster*>hitList;
|
||||||
virtual ~Bullet()=default;
|
virtual ~Bullet()=default;
|
||||||
Bullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1});
|
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.
|
//Initializes a bullet with an animation.
|
||||||
|
@ -63,20 +63,22 @@ void FrogTongue::Update(float fElapsedTime){
|
|||||||
}
|
}
|
||||||
if(friendly){
|
if(friendly){
|
||||||
for(Monster&m:MONSTER_LIST){
|
for(Monster&m:MONSTER_LIST){
|
||||||
if(geom2d::overlaps(m.Hitbox(),tongueLine)){
|
if(hitList.find(&m)==hitList.end()&&geom2d::overlaps(m.Hitbox(),tongueLine)){
|
||||||
MonsterHit(m);
|
MonsterHit(m);
|
||||||
|
hitList.insert(&m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool FrogTongue::PlayerHit(Player*player){
|
bool FrogTongue::PlayerHit(Player*player){
|
||||||
|
if(!deactivated){
|
||||||
player->Hurt(damage,OnUpperLevel(),0);
|
player->Hurt(damage,OnUpperLevel(),0);
|
||||||
deactivated=true;
|
deactivated=true;
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool FrogTongue::MonsterHit(Monster&monster){
|
bool FrogTongue::MonsterHit(Monster&monster){
|
||||||
monster.Hurt(damage,OnUpperLevel(),0);
|
monster.Hurt(damage,OnUpperLevel(),0);
|
||||||
deactivated=true;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void FrogTongue::Draw(){
|
void FrogTongue::Draw(){
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 5740
|
#define VERSION_BUILD 5743
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user