Tongue hitbox should be determined by current length of tongue, not final length.
This commit is contained in:
parent
8d471fe35e
commit
87cdff2218
@ -51,15 +51,19 @@ FrogTongue::FrogTongue(vf2d pos,vf2d targetPos,float lifetime,int damage,bool up
|
|||||||
}
|
}
|
||||||
void FrogTongue::Update(float fElapsedTime){
|
void FrogTongue::Update(float fElapsedTime){
|
||||||
geom2d::line<float>lineToTarget(pos,targetPos);
|
geom2d::line<float>lineToTarget(pos,targetPos);
|
||||||
|
vf2d drawVec=lineToTarget.vector().norm()*3;
|
||||||
|
|
||||||
tongueLength=util::lerp(0,lineToTarget.length(),sin((lifetime*PI)/duration));
|
tongueLength=util::lerp(0,lineToTarget.length(),sin((lifetime*PI)/duration));
|
||||||
|
|
||||||
if(!friendly&&geom2d::overlaps(game->GetPlayer()->Hitbox(),lineToTarget)){
|
vf2d tongueEndPos=geom2d::line<float>(pos+drawVec,targetPos).upoint(sin((lifetime*PI)/duration));
|
||||||
|
geom2d::line<float>tongueLine(pos+drawVec,tongueEndPos);
|
||||||
|
|
||||||
|
if(!friendly&&geom2d::overlaps(game->GetPlayer()->Hitbox(),tongueLine)){
|
||||||
PlayerHit(game->GetPlayer());
|
PlayerHit(game->GetPlayer());
|
||||||
}
|
}
|
||||||
if(friendly){
|
if(friendly){
|
||||||
for(Monster&m:MONSTER_LIST){
|
for(Monster&m:MONSTER_LIST){
|
||||||
if(geom2d::overlaps(m.Hitbox(),lineToTarget)){
|
if(geom2d::overlaps(m.Hitbox(),tongueLine)){
|
||||||
MonsterHit(m);
|
MonsterHit(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 5736
|
#define VERSION_BUILD 5737
|
||||||
|
|
||||||
#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