Skip to content

Commit

Permalink
Make planets wrap around properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
dulsi committed Jul 25, 2020
1 parent bdff40c commit fff0092
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1206,8 +1206,8 @@ proc menuUpdate(dt: float32) =
closestPlanet = nil
var nearestDistance: float32 = Inf
for planet in mitems(planets):
planet.pos.x += cos(frame.float32 / 100.0) * dt + -menuShip.vel.x * 0.1 * ((planet.z).float32 * 10.0)
planet.pos.y += sin(frame.float32 / 110.0) * dt + -menuShip.vel.y * 0.1 * ((planet.z).float32 * 10.0)
planet.pos.x += cos(frame.float32 / 100.0) * dt + -menuShip.vel.x * 0.1 * ((planet.z).float32 * 10.0) + 128.0
planet.pos.y += sin(frame.float32 / 110.0) * dt + -menuShip.vel.y * 0.1 * ((planet.z).float32 * 10.0) + 128.0

planet.pos.x = planet.pos.x mod 128.0
planet.pos.y = planet.pos.y mod 128.0
Expand Down

0 comments on commit fff0092

Please sign in to comment.