Advertisement
chris33556

position_issue

Sep 25th, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. extends KinematicBody
  2.  
  3. const MAX_SPEED = 100
  4. var position = 0.0
  5. onready var KinematicBody = get_node("/root/level/KinematicBody")
  6.  
  7. func _ready():
  8. pass # Replace with function body.
  9.  
  10.  
  11. func _physics_process(delta):
  12. if KinematicBody:
  13. var direction = (KinematicBody.position - position).normalized()
  14. move_and_slide(direction * MAX_SPEED)
  15.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement