⚔️ Hero class
This is the main class we'll use to manage the player, but for the framework its called Hero.
🌌 Hero global
This class will have the extern Hero variable so we can control stuff from the player across the game.
Important functions
💿 Initialization
extern void createHero(void);
This function is called in the start of the game, we want to set all the variables of the player here. As well as any texture initiation.
⏰ Loops
void cd();
The main loop for everything that should wait, here we can create variables with a int timer to wait for it such as:
int interacted = 0;
//our main thread runs at 16ms, so we can use this to multiply for the cd i.e 16x2 = 32ms
int i_cooldown = 0;
//cd for the interaction
int int_cd = 16;
In this example we are creating the boolean for the interaction (interacted), the int that will store the current cooldown (i_cooldown) and the int that will be the cd we want (int_cd) since our main thread runs at 16ms, if we set 16 the real time would be 16x16 = 256ms;
extern void animatePlayer(void);
The main loop for our animations, here we'll gather a tick (30 FPS) to loop the idle animation and any other animation we want based on variables.
extern void playerInput(void);
The main loop for our input detection, it has by default the movement, E and spacebar set.
⚙️ Interaction
void interact();
The main function for the interactions, add anything that you want to be done in the "E" key press.
void jump();
The function that will handle our jump or anything that you want to assign in the space key.