69 lines
1.3 KiB
C
69 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, libnum::num ax, libnum::num ay );
|
||
|
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 );
|
||
|
|
||
|
|
||
|
void Go_Up( int action, float dt );
|
||
|
void Go_Down( int action, float dt );
|
||
|
|
||
|
|
||
|
void Set_Speed( uint8_t _sp );
|
||
|
|
||
|
libnum::num x, y; // center position of the player
|
||
|
libnum::num vx, vy; // speed of the player as per x and 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)
|
||
|
|
||
|
int16_t life;
|
||
|
uint8_t speed; // speed of the player
|
||
|
uint32_t last_tick;
|
||
|
|
||
|
int8_t direction = STATIC;
|
||
|
int8_t action = STATIC;
|
||
|
};
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
#endif
|