64 lines
1.3 KiB
C++
64 lines
1.3 KiB
C++
#ifndef PLAYER_H
|
|
#define PLAYER_H
|
|
|
|
#include <azur/azur.h>
|
|
#include <azur/gint/render.h>
|
|
|
|
#include <cstdint>
|
|
#include <stdlib.h>
|
|
|
|
#include <num/num.h>
|
|
|
|
enum
|
|
{
|
|
STATIC = 0,
|
|
DRAFT = 1,
|
|
WALK = 2,
|
|
RUN = 3,
|
|
JUMP = 4,
|
|
FALL = 5,
|
|
};
|
|
|
|
enum
|
|
{
|
|
LEFT = -1,
|
|
CENTER = 0,
|
|
RIGHT = 1,
|
|
};
|
|
|
|
|
|
class Player
|
|
{
|
|
public:
|
|
Player( int16_t _x, int16_t _y );
|
|
~Player();
|
|
|
|
void Update( float dt );
|
|
void Render( );
|
|
|
|
void Left( float dt );
|
|
void Right( float dt );
|
|
void Nothing( float dt );
|
|
void Jump( float dt );
|
|
|
|
|
|
float currx, curry; // center position of the player
|
|
float nextx, nexty; // interim x and y position (to be tested to check if they can be actually achieved or not while moving)
|
|
|
|
float vx, vy; // speed of the player as per x and y coordinates
|
|
float ax, ay; // acceleration of the player as per x an y coordinates
|
|
|
|
uint16_t xscreen, yscreen;
|
|
uint8_t width, height; // width and height - for the hitbox
|
|
|
|
uint32_t last_tick;
|
|
|
|
bool playeronground = true;
|
|
float currentspeed = 0.0f;
|
|
|
|
int8_t direction = STATIC;
|
|
int8_t action = STATIC;
|
|
};
|
|
|
|
|
|
#endif |