mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Make PhysicsManager use Map#gravity, defined EARTH and MOON gravity's
This commit is contained in:
@@ -10,7 +10,7 @@ class IMICFPS
|
|||||||
MODEL_METER_SCALE = 1.0
|
MODEL_METER_SCALE = 1.0
|
||||||
|
|
||||||
# Earth
|
# Earth
|
||||||
GRAVITY = 9.8 # m/s
|
EARTH_GRAVITY = 9.8 # m/s
|
||||||
# Moon
|
# Moon
|
||||||
# GRAVITY = 1.625 # m/s
|
MOON_GRAVITY = 1.625 # m/s
|
||||||
end
|
end
|
||||||
@@ -31,7 +31,7 @@ class IMICFPS
|
|||||||
if on_ground
|
if on_ground
|
||||||
entity.velocity.y = 0
|
entity.velocity.y = 0
|
||||||
else
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class IMICFPS
|
|||||||
|
|
||||||
attr_reader :collision_manager
|
attr_reader :collision_manager
|
||||||
attr_reader :gravity
|
attr_reader :gravity
|
||||||
def initialize(map_loader:, gravity: IMICFPS::GRAVITY)
|
def initialize(map_loader:, gravity: IMICFPS::EARTH_GRAVITY)
|
||||||
@map_loader = map_loader
|
@map_loader = map_loader
|
||||||
@gravity = gravity
|
@gravity = gravity
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user