63 lines
1.3 KiB
C++
63 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
|
|
{
|
|
LEFT = -2,
|
|
RIGHT = -1,
|
|
STATIC = 0,
|
|
BREAK = 1,
|
|
WALK = 2,
|
|
RUN = 3,
|
|
JUMP = 4,
|
|
FALL = 5,
|
|
};
|
|
|
|
|
|
|
|
class Player
|
|
{
|
|
public:
|
|
Player( int16_t _x, int16_t _y );
|
|
~Player();
|
|
|
|
void Update( float dt );
|
|
void Render( );
|
|
|
|
void Walk_Left( float dt );
|
|
void Walk_Right( float dt );
|
|
|
|
void Run_Left( float dt );
|
|
void Run_Right( float dt );
|
|
|
|
void No_Order( float dt );
|
|
|
|
void Jump( float dt );
|
|
|
|
|
|
float x, y; // 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
|
|
|
|
uint8_t width, height; // width and height - for the hitbox
|
|
int16_t xmin, xmax, ymin, ymax; // square hitbox (to speed up the impact calculations)
|
|
|
|
uint32_t last_tick;
|
|
|
|
int8_t direction = STATIC;
|
|
int8_t action = STATIC;
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif |