player can move between orbits and free movement

This commit is contained in:
2025-11-28 17:16:26 -07:00
parent ac175ef371
commit 0bafe2cabd
+8 -2
View File
@@ -236,8 +236,14 @@ function love.update(dt)
if player_ship.velocity_x == 0 and player_ship.velocity_y == 0 then
player_ship.orbital_radius = player_ship.orbital_radius or math.sqrt(player_ship.position_x^2 + player_ship.position_y^2)
player_ship.rotation_offset = player_ship.rotation_offset or math.atan2(player_ship.position_y, player_ship.position_x) -- this will fail due to not being at timestep 0
-- might be fixable by computing where the game thinks the player should be and then adjusting it by where they are
if not player_ship.rotation_offset then
-- TEMP still locked to core_object
local argument = game_time / player_ship.orbital_radius^1.337 * orbital_speed_constant * core_object.radar_size^2
if (argument == math.huge) or (argument ~= argument) then
argument = 0
end
player_ship.rotation_offset = math.atan2(player_ship.position_y, player_ship.position_x) - argument
end
-- TEMP player_ship localed to core_object orbit
local argument = game_time / player_ship.orbital_radius^1.337 * orbital_speed_constant * core_object.radar_size^2 + player_ship.rotation_offset