spinning asteroids

This commit is contained in:
Donald Ball 2025-11-17 23:15:21 -05:00
parent eae3659768
commit 63b296e19c
2 changed files with 5 additions and 4 deletions

View file

@ -10,12 +10,13 @@ function phys.intersects(actor1, actor2)
end
-- updates the actor's location by applying the passage of time
-- TODO spin
function phys.update(actor, dt)
assert(actor.speed >= 0)
local dv = actor.speed * dt
actor.x = actor.x + math.cos(actor.angle) * dv
actor.y = actor.y + math.sin(actor.angle) * dv
local dr = actor.spin * dt
actor.facing = (actor.facing + dr) % phys.tau
end
function phys.apply(actor, force)