#ifndef OYUNCU_H #define OYUNCU_H #include #include "sprite-animator.h" #include "def.h" #include "matematik.h" #define PLAYER_SPEED_NORMAL 40 #define PLAYER_SPEED_SPRINT 65 /* enum player_states { */ /* PS_STANDING = 1, */ /* PS_WALKING = 2, */ /* PS_RUNNING = 4, */ /* PS_MOVE_STATE = PS_STANDING | PS_WALKING | PS_RUNNING, */ /* PS_CAN_MOVE = 8, */ /* PS_IFRAME_ACTIVE = 16 */ /* }; */ #define PS_STANDING 0 #define PS_WALKING 1 #define PS_RUNNING 2 typedef struct { unsigned int move : 2; unsigned int can_move : 1; unsigned int iframe_active : 1; unsigned int alive : 1; } player_state_t; typedef struct Player { Vector2 position; Vector2 direction; int speed; int health; int health_max; Rectangle hitbox; float iframe_duration; float iframe_duration_max; animation_player_t animation; Camera2D camera; player_state_t state; } player_t; void input_player_direction(player_t *p); void update_player(player_t *p, float dt); void draw_player(player_t *p); player_t make_player(Texture2D *texture); int take_damage(player_t *p, int amount); typedef enum SpriteDirections { SP_NORTH, SP_NORTH_EAST, SP_EAST, SP_SOUTH_EAST, SP_SOUTH, SP_SOUTH_WEST, SP_WEST, SP_NORTH_WEST, } sprite_dir_enum; sprite_dir_enum get_dir(int index); #endif