Add in Charged Shot ability and allow precasting without the targeting indicator.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#include "BulletTypes.h"
|
||||
#include "Effect.h"
|
||||
#include "Crawler.h"
|
||||
#include "DEFINES.h"
|
||||
#include "utils.h"
|
||||
#include "olcUTIL_Geometry2D.h"
|
||||
|
||||
INCLUDE_game
|
||||
|
||||
ChargedArrow::ChargedArrow(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly,Pixel col)
|
||||
:lastLaserPos(pos),
|
||||
Bullet(pos,vel,radius,damage,
|
||||
AnimationState::CHARGED_ARROW,upperLevel,true,INFINITE,true,friendly,col){}
|
||||
|
||||
void ChargedArrow::Update(float fElapsedTime){
|
||||
geom2d::line lineToCurrentPos(geom2d::line(lastLaserPos,pos));
|
||||
float dist=lineToCurrentPos.length();
|
||||
if(dist>=1){
|
||||
vf2d midpoint(lineToCurrentPos.rpoint(0.5));
|
||||
game->AddEffect(std::make_unique<Effect>(midpoint,0.1,AnimationState::LASER,upperLevel,vf2d{1,dist},0.3,vf2d{},Pixel{192,128,238},atan2(pos.y-lastLaserPos.y,pos.x-lastLaserPos.x)+PI/2,0,true));
|
||||
lastLaserPos=pos;
|
||||
}
|
||||
}
|
||||
|
||||
bool ChargedArrow::PlayerHit(Player*player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ChargedArrow::MonsterHit(Monster& monster)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user