The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'!
https://forums.lestoria.net
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.2 KiB
31 lines
1.2 KiB
#include "Bullet.h"
|
|
#include "Crawler.h"
|
|
#include "DEFINES.h"
|
|
|
|
INCLUDE_ANIMATION_DATA
|
|
INCLUDE_game
|
|
|
|
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,Pixel col)
|
|
:pos(pos),vel(vel),radius(radius),damage(damage),col(col){};
|
|
|
|
Bullet::Bullet(vf2d pos,vf2d vel,float radius,int damage,AnimationState animation,bool hitsMultiple,float lifetime,bool rotatesWithAngle,Pixel col)
|
|
:pos(pos),vel(vel),radius(radius),damage(damage),col(col),animated(true),rotates(rotatesWithAngle),lifetime(lifetime),hitsMultiple(hitsMultiple){
|
|
this->animation.AddState(animation,ANIMATION_DATA[animation]);
|
|
this->animation.ChangeState(internal_animState,animation);
|
|
};
|
|
|
|
Animate2D::Frame Bullet::GetFrame(){
|
|
return animation.GetFrame(internal_animState);
|
|
}
|
|
|
|
void Bullet::Update(float fElapsedTime){
|
|
}
|
|
|
|
void Bullet::Draw(){
|
|
if(animated){
|
|
game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotates?atan2(vel.y,vel.x)-PI/2:0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,{1,1},col);
|
|
} else {
|
|
game->view.DrawDecal(pos,game->GFX_BulletCircle.Decal(),{radius,radius},col);
|
|
game->view.DrawDecal(pos,game->GFX_BulletCircleOutline.Decal(),{radius,radius},WHITE);
|
|
}
|
|
} |