I have an infinite runner game set up, the idea is that you can flip gravity. But if I set my gravity variable to anything higher than 50, the player object sinks into the ground. The player is a RigidBody2D in character mode (because I couldn't figure out collisions for a KinematicBody2D), and the ground is made of StaticBody2D tiles. Here is the player movement script:
func _input(flipGravity):
if Input.is_action_pressed("flipGravity") and gravityFlipped == true:
motionVector.y = 0
gravityFlipped = false;
get_node("player/playerSprite").set_flip_v(false)
motionVector = Vector2(speed, gravity)
elif Input.is_action_pressed("flipGravity") and gravityFlipped == false:
motionVector.y = 0
gravityFlipped = true;
get_node("player/playerSprite").set_flip_v(true)
motionVector = Vector2(speed, -gravity)
func _fixed_process(delta):
var playerPosition = get_node("player").get_pos()
playerPosition += motionVector * delta
get_node("player").set_pos(playerPosition)
speed += 0.01