Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func attempt_correction(amount: int):
- var delta = get_physics_process_delta_time()
- if velocity.y < 0 and test_move(global_transform,
- Vector2(0, velocity.y*delta)):
- for i in range(1, amount*2+1):
- for j in [-1.0, 1.0]:
- if !test_move(global_transform.translated(Vector2(i*j/2, 0)),
- Vector2(0, velocity.y*delta)):
- translate(Vector2(i*j/2, 0))
- if velocity.x * j < 0: velocity.x = 0
- return
Advertisement
Add Comment
Please, Sign In to add comment