Add ground gravity

This commit is contained in:
Spencer Killen 2022-12-28 10:37:27 -07:00
parent ba02781ce0
commit 7bd52b4507
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
7 changed files with 11 additions and 8 deletions

BIN
blends/levels/creek_platform.blend (Stored with Git LFS)

Binary file not shown.

View File

@ -1,3 +1,3 @@
source_md5="dc558dbf7581e287a28daca6be3a1cca" source_md5="972d81b0bd575b1c674dc10df9a572c3"
dest_md5="c542e847721acd50c307244492ab8175" dest_md5="9b133d04e1308f2e5962308f1d907e03"

BIN
godot/assets/meat_creek/creek_platform.glb (Stored with Git LFS)

Binary file not shown.

View File

@ -61,7 +61,7 @@ transform = Transform( 0.0716538, 0, 0.99743, 0, 1, 0, -0.99743, 0, 0.0716538, -
environment = SubResource( 3 ) environment = SubResource( 3 )
[node name="SinkBlock" parent="." index="4" instance=ExtResource( 5 )] [node name="SinkBlock" parent="." index="4" instance=ExtResource( 5 )]
transform = Transform( 80, 0, 0, 0, 6.74679, 0, 0, 0, 80, 0, -5.81972, -43.3626 ) transform = Transform( 80, 0, 0, 0, 3.87358, 0, 0, 0, 80, 0, -3.3489, -43.3626 )
[node name="platforms" type="Spatial" parent="." index="5"] [node name="platforms" type="Spatial" parent="." index="5"]
@ -139,6 +139,7 @@ max_db = 6.0
max_distance = 200.0 max_distance = 200.0
[node name="upper_shelf" parent="." index="10" instance=ExtResource( 13 )] [node name="upper_shelf" parent="." index="10" instance=ExtResource( 13 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.09789, 0 )
[node name="AmbientSounds" type="Node" parent="." index="11"] [node name="AmbientSounds" type="Node" parent="." index="11"]

View File

@ -5,6 +5,7 @@ onready var util = get_node("/root/Util")
export var gravity: float = 6.0 export var gravity: float = 6.0
# When falling, gravity is artificially increased # When falling, gravity is artificially increased
export var gravity_downwards_factor: float = 3 export var gravity_downwards_factor: float = 3
export var ground_gravity: float = 3.1
# Rate of gaining speed # Rate of gaining speed
export var velocity_acceleration_xz: float = 3 export var velocity_acceleration_xz: float = 3
export var velocity_acceleration_y: float = 5 export var velocity_acceleration_y: float = 5
@ -51,6 +52,8 @@ func process_velocity(delta: float):
else: else:
velocity.y = max(0.0, velocity.y) velocity.y = max(0.0, velocity.y)
target_velocity.y = max(0.0, max(target_velocity.y, jump_power * $"../MovementInput".jump_intent * jump_permission)) target_velocity.y = max(0.0, max(target_velocity.y, jump_power * $"../MovementInput".jump_intent * jump_permission))
if target_velocity.y == 0.0 and velocity.y == 0.0:
velocity.y = -ground_gravity
if not is_jumping and $"../MovementInput".jump_intent != 0.0 and is_on_floor(): if not is_jumping and $"../MovementInput".jump_intent != 0.0 and is_on_floor():
jump_permission = 0.0 jump_permission = 0.0
is_jumping = true is_jumping = true

View File

@ -13,7 +13,6 @@ func _ready():
_ignore = GlobalEventBus.connect("player_exited_meat_sink", self, "exit_water") _ignore = GlobalEventBus.connect("player_exited_meat_sink", self, "exit_water")
func enter_water(): func enter_water():
print(2)
in_water += 1 in_water += 1
func exit_water(): func exit_water():