player can move between orbits and free movement
This commit is contained in:
+8
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user