parent
918fc112bd
commit
045441b595
@ -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; |
||||
} |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 582 B |
@ -1,6 +1,9 @@ |
||||
#pragma once |
||||
#include <stdlib.h> |
||||
#include "olcUTIL_Geometry2D.h" |
||||
namespace util{ |
||||
//Returns 0-range (as a float).
|
||||
float random(float range); |
||||
//Returns a normalized vector pointing from posFrom towards posTo.
|
||||
vf2d pointTo(vf2d posFrom,vf2d posTo); |
||||
} |
Loading…
Reference in new issue