bullet recoil, use tau

This commit is contained in:
Donald Ball 2025-11-17 20:31:14 -05:00
parent f5df911707
commit 5bcf22a6f8
2 changed files with 8 additions and 13 deletions

View file

@ -18,10 +18,6 @@ function phys.update(actor, dt)
actor.y = actor.y + math.sin(actor.angle) * dv
end
function phys.rotate(actor, angle)
actor.facing = (actor.facing + angle) % phys.tau
end
function phys.apply(actor, force)
local ax = math.cos(actor.angle) * actor.speed
local ay = math.sin(actor.angle) * actor.speed
@ -31,7 +27,7 @@ function phys.apply(actor, force)
local y = ay + fy
local speed = math.sqrt(x ^ 2 + y ^ 2)
local angle = math.atan2(y, x) % phys.tau
local angle = math.atan2(y, x)
actor.speed = speed
actor.angle = angle
end