Guest User

GDScript Corner Correction

a guest
Aug 27th, 2021
892
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. func attempt_correction(amount: int):
  2.     var delta = get_physics_process_delta_time()
  3.     if velocity.y < 0 and test_move(global_transform,
  4.     Vector2(0, velocity.y*delta)):
  5.         for i in range(1, amount*2+1):
  6.             for j in [-1.0, 1.0]:
  7.                 if !test_move(global_transform.translated(Vector2(i*j/2, 0)),
  8.                 Vector2(0, velocity.y*delta)):
  9.                     translate(Vector2(i*j/2, 0))
  10.                     if velocity.x * j < 0: velocity.x = 0
  11.                     return
Advertisement
Add Comment
Please, Sign In to add comment