|
|
|
#pragma once
|
|
|
|
#include "olcUTIL_Animate2D.h"
|
|
|
|
#include "Animation.h"
|
|
|
|
#include "Monster.h"
|
|
|
|
#include "State.h"
|
|
|
|
|
|
|
|
struct Player{
|
|
|
|
private:
|
|
|
|
int hp=100,maxhp=hp;
|
|
|
|
int atk=10;
|
|
|
|
vf2d pos;
|
|
|
|
float z=0;
|
|
|
|
float moveSpd=1.0f;
|
|
|
|
float size=1.0f;
|
|
|
|
float attack_range=1.5f;
|
|
|
|
const float ATTACK_COOLDOWN=0.75f;
|
|
|
|
float attack_cooldown_timer=0;
|
|
|
|
float spin_attack_timer=0;
|
|
|
|
float spin_spd=0;
|
|
|
|
float spin_angle=0;
|
|
|
|
float lastAnimationFlip=0;
|
|
|
|
State state;
|
|
|
|
Animate2D::Animation<AnimationState>animation;
|
|
|
|
Animate2D::AnimationState internal_animState;
|
|
|
|
Key lastReleasedMovementKey;
|
|
|
|
Key facingDirection;
|
|
|
|
public:
|
|
|
|
Player();
|
|
|
|
Player(vf2d pos);
|
|
|
|
const static float GROUND_SLAM_SPIN_TIME;
|
|
|
|
void SetX(float x);
|
|
|
|
void SetY(float y);
|
|
|
|
void SetZ(float z);
|
|
|
|
void SetPos(vf2d pos);
|
|
|
|
vf2d&GetPos();
|
|
|
|
float GetX();
|
|
|
|
float GetY();
|
|
|
|
float GetZ();
|
|
|
|
int GetHealth();
|
|
|
|
int GetMaxHealth();
|
|
|
|
int GetAttack();
|
|
|
|
float GetMoveSpdMult();
|
|
|
|
float GetSizeMult();
|
|
|
|
float GetAttackRangeMult();
|
|
|
|
float GetSpinAngle();
|
|
|
|
State GetState();
|
|
|
|
void SetFacingDirection(Key direction);
|
|
|
|
Key GetFacingDirection();
|
|
|
|
|
|
|
|
void Hurt(int damage);
|
|
|
|
|
|
|
|
void Spin(float duration,float spinSpd);
|
|
|
|
void Update(float fElapsedTime);
|
|
|
|
void AddAnimation(AnimationState state);
|
|
|
|
void UpdateAnimation(AnimationState animState);
|
|
|
|
Animate2D::Frame GetFrame();
|
|
|
|
void SetLastReleasedMovementKey(Key k);
|
|
|
|
Key GetLastReleasedMovementKey();
|
|
|
|
|
|
|
|
//Triggers when the player has moved.
|
|
|
|
void Moved();
|
|
|
|
};
|