diff --git a/lib/constants.rb b/lib/constants.rb index 5930462..13342df 100644 --- a/lib/constants.rb +++ b/lib/constants.rb @@ -10,7 +10,7 @@ class IMICFPS MODEL_METER_SCALE = 1.0 # Earth - GRAVITY = 9.8 # m/s + EARTH_GRAVITY = 9.8 # m/s # Moon - # GRAVITY = 1.625 # m/s + MOON_GRAVITY = 1.625 # m/s end \ No newline at end of file diff --git a/lib/managers/physics_manager.rb b/lib/managers/physics_manager.rb index ada9330..671783b 100644 --- a/lib/managers/physics_manager.rb +++ b/lib/managers/physics_manager.rb @@ -31,7 +31,7 @@ class IMICFPS if on_ground entity.velocity.y = 0 else - entity.velocity.y -= IMICFPS::GRAVITY * entity.delta_time if entity.physics + entity.velocity.y -= @collision_manager.map.gravity * entity.delta_time if entity.physics end end end diff --git a/lib/map.rb b/lib/map.rb index 0eaf66f..ae976b8 100644 --- a/lib/map.rb +++ b/lib/map.rb @@ -5,7 +5,7 @@ class IMICFPS attr_reader :collision_manager attr_reader :gravity - def initialize(map_loader:, gravity: IMICFPS::GRAVITY) + def initialize(map_loader:, gravity: IMICFPS::EARTH_GRAVITY) @map_loader = map_loader @gravity = gravity