spinning asteroids
This commit is contained in:
parent
eae3659768
commit
63b296e19c
2 changed files with 5 additions and 4 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue