chore: removed tabs from whitespace-only lines
This commit is contained in:
parent
b1a4fa2f0a
commit
ece2a24a78
|
@ -25,7 +25,7 @@ void Internal_PlayerInitInput(Player* self) {
|
|||
Player* MakePlayer() {
|
||||
Player* self = malloc(sizeof(Player));
|
||||
ASSERT_RETURN(self != NULL, NULL, "Failed to allocate space for new Player instance");
|
||||
|
||||
|
||||
*self = (Player) {
|
||||
.transform = IdentityTransform,
|
||||
|
||||
|
@ -47,7 +47,7 @@ Player* MakePlayer() {
|
|||
|
||||
.animationStateMachine = NULL,
|
||||
};
|
||||
|
||||
|
||||
self->rigidbody = rigidbody_make(Player_as_Transformable(self));
|
||||
self->physicsCollider = collider_new(Player_as_PhysicsEntity(self), shape_new((Vector[]){
|
||||
MakeVector(-0.2, -0.065),
|
||||
|
@ -55,26 +55,26 @@ Player* MakePlayer() {
|
|||
MakeVector( 0.2, 0.065),
|
||||
MakeVector(-0.2, 0.065)
|
||||
}, 4), 0, PHYSICS_LAYER_DEFAULT);
|
||||
|
||||
|
||||
sprite_set_origin(self->sprite, MakeVector(0.45f, 0.925f));
|
||||
|
||||
|
||||
self->idle = animation_sprite_new(self->sprite, spritesheet_load("assets/Player_Idle.png", IVectorFrom(512)), 1.5f, LoopMode_Loop);
|
||||
self->walk = animation_sprite_new(self->sprite, spritesheet_load("assets/Player_Walk.png", IVectorFrom(512)), 5.f, LoopMode_Loop);
|
||||
self->jab_a = animation_sprite_new(self->sprite, spritesheet_load("assets/Player_Jab_A.png", IVectorFrom(512)), 10.f, LoopMode_Stop);
|
||||
self->jab_b = animation_sprite_new(self->sprite, spritesheet_load("assets/Player_Jab_B.png", IVectorFrom(512)), 10.f, LoopMode_Stop);
|
||||
|
||||
self->animationStateMachine = state_machine_init(self, PlayerIdle());
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
Player* SpawnPlayer(Vector location) {
|
||||
Player* self = MakePlayer();
|
||||
self->transform.position = location;
|
||||
|
||||
|
||||
game_world_add_entity(Player_as_BehaviourEntity(self));
|
||||
physics_world_add_entity(Player_as_PhysicsEntity(self));
|
||||
|
||||
|
||||
Internal_PlayerInitInput(self);
|
||||
return self;
|
||||
}
|
||||
|
@ -82,15 +82,15 @@ Player* SpawnPlayer(Vector location) {
|
|||
void DestroyPlayer(Player* self) {
|
||||
collider_destroy(self->physicsCollider);
|
||||
rigidbody_destroy(self->rigidbody);
|
||||
|
||||
|
||||
playerinput_drop(self->playerInput);
|
||||
|
||||
|
||||
animation_sprite_destroy(self->idle);
|
||||
animation_sprite_destroy(self->walk);
|
||||
animation_sprite_destroy(self->jab_a);
|
||||
animation_sprite_destroy(self->jab_b);
|
||||
sprite_destroy(self->sprite);
|
||||
|
||||
|
||||
state_machine_destroy(self->animationStateMachine);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,15 +16,15 @@ extern const Vector PLAYER_SPEED;
|
|||
|
||||
typedef struct Player {
|
||||
Transform transform;
|
||||
|
||||
|
||||
RigidBody* rigidbody;
|
||||
Collider* physicsCollider;
|
||||
|
||||
|
||||
PlayerInput* playerInput;
|
||||
|
||||
|
||||
Vector moveInput;
|
||||
int attackInput;
|
||||
|
||||
|
||||
int facing;
|
||||
|
||||
Sprite* sprite;
|
||||
|
@ -35,7 +35,7 @@ typedef struct Player {
|
|||
AnimationSprite* jab_b;
|
||||
|
||||
StateMachine* animationStateMachine;
|
||||
|
||||
|
||||
AnimationSprite* currentAnimation;
|
||||
} Player;
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ const State* PlayerIdleUpdate(Player* self, float deltaTime) {
|
|||
return PlayerWalk();
|
||||
if(self->attackInput)
|
||||
return PlayerJabA();
|
||||
|
||||
return PlayerIdle();
|
||||
}
|
||||
|
||||
|
@ -35,7 +34,7 @@ void PlayerWalk_Enter(Player* self) {
|
|||
|
||||
const State* PlayerWalk_Update(Player* self, float deltaTime) {
|
||||
rigidbody_set_velocity(self->rigidbody, vmulf(vnormalizedf(self->moveInput), PLAYER_SPEED));
|
||||
|
||||
|
||||
if(veqf(self->moveInput, ZeroVector))
|
||||
return PlayerIdle();
|
||||
if(self->attackInput)
|
||||
|
@ -54,9 +53,10 @@ void PlayerJabA_Enter(Player* self) {
|
|||
PlayerAttackEnter(self);
|
||||
self->currentAnimation = self->jab_a;
|
||||
animation_sprite_play_from(self->currentAnimation, 0.f);
|
||||
|
||||
Collider* found = physics_world_box_query(vaddf(self->transform.position, MakeVector(self->facing * (0.2f + 0.05f), 0.f)),
|
||||
MakeVector(0.05f, 0.06f), PHYSICS_LAYER_DEFAULT, self->rigidbody);
|
||||
|
||||
Collider* found = physics_world_box_query(vaddf(self->transform.position, MakeVector(self->facing * (0.2f + 0.1f), 0.f)),
|
||||
MakeVector(0.1f, 0.06f), PHYSICS_LAYER_DEFAULT, self->rigidbody);
|
||||
|
||||
if(found != NULL)
|
||||
LOG_INFO("Query returned %p", found);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue