Prep player class structure refactor. Add default destructors to all parent classes.
This commit is contained in:
parent
93cf655a40
commit
1f69848049
@ -27,6 +27,7 @@ public:
|
||||
Animate2D::Animation<AnimationState>animation;
|
||||
Animate2D::AnimationState internal_animState;
|
||||
std::map<Monster*,bool>hitList;
|
||||
virtual ~Bullet()=default;
|
||||
Bullet(vf2d pos,vf2d vel,float radius,int damage,bool upperLevel,bool friendly=false,Pixel col=WHITE);
|
||||
//Initializes a bullet with an animation.
|
||||
Bullet(vf2d pos,vf2d vel,float radius,int damage,AnimationState animation,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool rotatesWithAngle=false,bool friendly=false,Pixel col=WHITE);
|
||||
|
BIN
Crawler/Crawler
BIN
Crawler/Crawler
Binary file not shown.
@ -87,7 +87,7 @@ bool Crawler::OnUserCreate(){
|
||||
|
||||
LoadLevel(CAMPAIGN_1_1);
|
||||
|
||||
player.SetClass(WARRIOR);
|
||||
player.ChangeClass(WARRIOR);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -140,26 +140,26 @@ void Crawler::HandleUserInput(float fElapsedTime){
|
||||
if(GetMouseWheel()>0){
|
||||
switch(player.cl){
|
||||
case WARRIOR:{
|
||||
player.SetClass(RANGER);
|
||||
player.ChangeClass(RANGER);
|
||||
}break;
|
||||
case RANGER:{
|
||||
player.SetClass(WIZARD);
|
||||
player.ChangeClass(WIZARD);
|
||||
}break;
|
||||
case WIZARD:{
|
||||
player.SetClass(WARRIOR);
|
||||
player.ChangeClass(WARRIOR);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
if(GetMouseWheel()<0){
|
||||
switch(player.cl){
|
||||
case WARRIOR:{
|
||||
player.SetClass(WIZARD);
|
||||
player.ChangeClass(WIZARD);
|
||||
}break;
|
||||
case RANGER:{
|
||||
player.SetClass(WARRIOR);
|
||||
player.ChangeClass(WARRIOR);
|
||||
}break;
|
||||
case WIZARD:{
|
||||
player.SetClass(RANGER);
|
||||
player.ChangeClass(RANGER);
|
||||
}break;
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ struct Emitter{
|
||||
float frequency;
|
||||
float timer;
|
||||
float lastEmit=0;
|
||||
virtual ~Emitter()=default;
|
||||
Emitter(float frequency,float timer);
|
||||
bool Update(float fElapsedTime);
|
||||
virtual void Emit()=0;
|
||||
|
@ -19,7 +19,7 @@ const float Player::GROUND_SLAM_SPIN_TIME=0.6f;
|
||||
Player::Player():
|
||||
state(State::NORMAL),lastReleasedMovementKey(DOWN),facingDirection(DOWN){}
|
||||
|
||||
void Player::SetClass(Class cl){
|
||||
void Player::ChangeClass(Class cl){
|
||||
this->cl=CLASS_DATA[cl]->cl;
|
||||
rightClickAbility=CLASS_DATA[cl]->rightClickAbility;
|
||||
ability1=CLASS_DATA[cl]->ability1;
|
||||
|
@ -10,15 +10,8 @@
|
||||
|
||||
struct Player{
|
||||
friend class Crawler;
|
||||
friend class Warrior;
|
||||
friend class Thief;
|
||||
friend class Ranger;
|
||||
friend class Bard;
|
||||
friend class Wizard;
|
||||
friend class Witch;
|
||||
friend class sig::Animation;
|
||||
private:
|
||||
Class cl=WARRIOR;
|
||||
int hp=100,maxhp=hp;
|
||||
int mana=100,maxmana=mana;
|
||||
int atk=10;
|
||||
@ -54,6 +47,9 @@ struct Player{
|
||||
bool upperLevel=false;
|
||||
void AddAnimation(AnimationState state);
|
||||
void Update(float fElapsedTime);
|
||||
void ChangeClass(Class cl);
|
||||
std::vector<Buff>buffList;
|
||||
protected:
|
||||
void SetSwordSwingTimer(float val);
|
||||
void SetState(State newState);
|
||||
void SetFacingDirection(Key direction);
|
||||
@ -66,9 +62,6 @@ struct Player{
|
||||
void SetZ(float z);
|
||||
//Returns true if the move was valid and successful.
|
||||
bool SetPos(vf2d pos);
|
||||
void SetClass(Class cl);
|
||||
std::vector<Buff>buffList;
|
||||
protected:
|
||||
public:
|
||||
Player();
|
||||
const static float GROUND_SLAM_SPIN_TIME;
|
||||
@ -109,4 +102,11 @@ struct Player{
|
||||
|
||||
//Triggers when the player has moved.
|
||||
void Moved();
|
||||
virtual ~Player()=default;
|
||||
virtual Class GetClass();
|
||||
virtual bool AutoAttack();
|
||||
virtual bool Ability1();
|
||||
virtual bool Ability2();
|
||||
virtual bool Ability3();
|
||||
virtual bool RightClickAbility();
|
||||
};
|
@ -3,7 +3,7 @@ export AUTO_UPDATE=true
|
||||
source utils/define.sh
|
||||
|
||||
define PROJECT_NAME "Crawler"
|
||||
define CUSTOM_PARAMS "-std=c++17 -lX11 -lGL -lpthread -lpng -lstdc++fs -I/usr/include/lua5.3"
|
||||
define CUSTOM_PARAMS "-std=c++17 -lX11 -lpthread -lpng -lstdc++fs -I/usr/include/lua5.3"
|
||||
define LANGUAGE "C++"
|
||||
|
||||
source utils/main.sh
|
||||
|
Loading…
x
Reference in New Issue
Block a user