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.
25 lines
509 B
25 lines
509 B
#include "Player.h"
|
|
|
|
Player::Player(olc::vi2d pos,Rect*sprite)
|
|
:pos(pos),sprite(sprite){}
|
|
olc::vf2d Player::GetPos(){
|
|
return pos;
|
|
}
|
|
olc::vi2d Player::GetSprPos(){
|
|
return sprite->GetPos();
|
|
}
|
|
olc::vi2d Player::GetSprSize(){
|
|
return sprite->GetSize();
|
|
}
|
|
void Player::Update(float fElapsedTime){
|
|
lastShootTime=std::max(lastShootTime-fElapsedTime,0.f);
|
|
}
|
|
bool Player::CanShoot(){
|
|
return lastShootTime==0;
|
|
}
|
|
void Player::OnShoot(){
|
|
lastShootTime=0.5;
|
|
}
|
|
void Player::Move(olc::vf2d moveAmt){
|
|
pos+=moveAmt;
|
|
} |