Skip to content

Commit

Permalink
fixed small bug with projectiles
Browse files Browse the repository at this point in the history
  • Loading branch information
kambot committed Aug 31, 2023
1 parent 5503a15 commit fe91737
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/projectile.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,12 @@ void projectile_update(float delta_t)
continue;
}

delta_t = RANGE(delta_t, 0.0, proj->ttl - proj->time);
float _dt = RANGE(proj->ttl - proj->time, 0.0, delta_t);

proj->time += delta_t;
proj->time += _dt;


proj->phys.pos.x += delta_t*proj->vel.x;
proj->phys.pos.y -= delta_t*proj->vel.y; // @minus
proj->phys.pos.x += _dt*proj->vel.x;
proj->phys.pos.y -= _dt*proj->vel.y; // @minus

memcpy(&proj->grid_pos_prior, &proj->grid_pos, sizeof(Vector2i));
coords_to_map_grid(proj->phys.pos.x, proj->phys.pos.y, &proj->grid_pos.x, &proj->grid_pos.y);
Expand Down

0 comments on commit fe91737

Please sign in to comment.