I'm working on my 2D Platformer game. The problem is that when I try to go up on a 45-degree tile, it can't go up.
I try to play with some variables. One that's successful is to make the gravity low (from 2000 to 100), but it will make the fall slower. I want to keep the gravity as it is.
Do you have a better way to do it?
Actor.gd
func _physics_process(delta: float) -> void:
apply_gravity(delta)
control()
func apply_gravity(delta: float) -> void:
velocity.y += gravity * delta
func control() -> void:
pass
Player.gd
func control() -> void:
get_input_direction()
match state:
STATES.IDLE:
idle_state()
STATES.MOVE:
move_state()
STATES.CROUCH:
crouch_state()
STATES.AERIAL:
aerial_state()
var snap = Vector2.DOWN * 16 if !is_jumping else Vector2.ZERO
velocity = move_and_slide_with_snap(velocity, snap, FLOOR_UP, true)