84 lines
1.7 KiB
C
84 lines
1.7 KiB
C
#ifndef FIGHT_PLAYER_H
|
|
#define FIGHT_PLAYER_H
|
|
|
|
#include "state_machine.h"
|
|
#include "state.h"
|
|
#include "behaviour_entity.h"
|
|
#include "animation_sprite.h"
|
|
#include "input.h"
|
|
#include "vmath.h"
|
|
#include "transform.h"
|
|
#include "player_input.h"
|
|
#include "rigidbody.h"
|
|
#include "collider.h"
|
|
|
|
extern const Vector PLAYER_SPEED;
|
|
|
|
typedef struct Player {
|
|
Transform transform;
|
|
|
|
RigidBody* rigidbody;
|
|
Collider* physicsCollider;
|
|
|
|
PlayerInput* playerInput;
|
|
|
|
Vector moveInput;
|
|
int attackInput;
|
|
|
|
int facing;
|
|
|
|
Sprite* sprite;
|
|
|
|
AnimationSprite* idle;
|
|
AnimationSprite* walk;
|
|
AnimationSprite* jab_a;
|
|
AnimationSprite* jab_b;
|
|
|
|
StateMachine* animationStateMachine;
|
|
|
|
AnimationSprite* currentAnimation;
|
|
} Player;
|
|
|
|
Player* MakePlayer();
|
|
Player* SpawnPlayer(Vector location);
|
|
void DestroyPlayer(Player* self);
|
|
|
|
void PlayerHorizontalInput(Player* self, InputEvent value);
|
|
void PlayerVerticalInput(Player* self, InputEvent value);
|
|
void PlayerAttackInput(Player* self, InputEvent value);
|
|
|
|
void PlayerStart(Player* self);
|
|
void PlayerUpdate(Player* self, float deltaTime);
|
|
void PlayerDraw(Player* self);
|
|
|
|
Transform* PlayerGetTransform(Player* self);
|
|
|
|
RigidBody* PlayerGetRigidBody(Player* self);
|
|
void PlayerOnCollision(Player* self, Collision collision);
|
|
void PlayerOnOverlap(Player* self, Collider* other);
|
|
|
|
static long PlayerGetDepth(Player* self) { return -10-(int)(self->transform.position.y * 1000); }
|
|
|
|
impl_Drop_for(Player,
|
|
DestroyPlayer
|
|
)
|
|
|
|
impl_BehaviourEntity_for(Player,
|
|
PlayerStart,
|
|
PlayerUpdate,
|
|
PlayerDraw,
|
|
PlayerGetDepth
|
|
)
|
|
|
|
impl_Transformable_for(Player,
|
|
PlayerGetTransform
|
|
)
|
|
|
|
impl_PhysicsEntity_for(Player,
|
|
PlayerGetRigidBody,
|
|
PlayerOnCollision,
|
|
PlayerOnOverlap
|
|
)
|
|
|
|
#endif // !FIGHT_PLAYER_H
|