implemented jump
This commit is contained in:
parent
07f534f796
commit
3263c87cca
12
src/player.c
12
src/player.c
|
@ -61,11 +61,15 @@ void player_start(Player* self) {
|
|||
|
||||
void player_update(Player* self, float dt) {
|
||||
Vector velocity = rigidbody_get_velocity(self->rigidbody);
|
||||
Vector velocity_target = {directional.x, directional.y};
|
||||
rigidbody_accelerate(self->rigidbody, vmulff(vsubf(velocity_target, velocity), 20.f), 0);
|
||||
// rigidbody_accelerate(self->rigidbody, (Vector){0.0f, 20.f}, 0);
|
||||
Vector velocity_target = {directional.x, velocity.y};
|
||||
if(directional.y < 0) {
|
||||
directional.y = 0;
|
||||
velocity.y = -20.f;
|
||||
rigidbody_set_velocity(self->rigidbody, velocity);
|
||||
}
|
||||
rigidbody_accelerate(self->rigidbody, vmulff(vsubf(velocity_target, velocity), 50.f), 0);
|
||||
rigidbody_accelerate(self->rigidbody, (Vector){0.0f, 100.f}, 0);
|
||||
|
||||
// LOG_INFO("%f %f", self->transform.position.x, self->transform.position.y);
|
||||
}
|
||||
|
||||
void player_collision(Player* self, Collision hit) {
|
||||
|
|
Loading…
Reference in a new issue