diff --git a/asteroids/main.lua b/asteroids/main.lua index ccdaccd..27427fc 100644 --- a/asteroids/main.lua +++ b/asteroids/main.lua @@ -58,7 +58,7 @@ local function initState() local stage = game.asteroids.stages[asteroid.stage] asteroid.speed = stage.speed asteroid.facing = math.random() * phys.tau - asteroid.spin = 2 + math.random() * 5 + asteroid.spin = 0.1 + math.random() * 0.1 asteroid.radius = stage.radius asteroid.sprite = stage.sprite end @@ -141,7 +141,7 @@ function love.update(dt) radius = radius, speed = speed, facing = math.random() * phys.tau, - spin = 2 + math.random() * 5, + spin = 0.1 + math.random() * 0.1, sprite = sprite, }) table.insert(state.asteroids, { @@ -152,7 +152,7 @@ function love.update(dt) radius = radius, speed = speed, facing = math.random() * phys.tau, - spin = 2 + math.random() * 5, + spin = 0.1 + math.random() * 0.1, sprite = sprite, }) end diff --git a/asteroids/phys.lua b/asteroids/phys.lua index 3772423..5b1e003 100644 --- a/asteroids/phys.lua +++ b/asteroids/phys.lua @@ -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)