Advertisement
Szczepan86

Godot - fizyka

Apr 28th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. extends RigidBody2D
  2.  
  3. var wcisniety_przycisk
  4. var miejsce_wcisniecia = Vector2()
  5.  
  6. func _input(event):
  7. if event.is_action_pressed("click") and not wcisniety_przycisk:
  8. wcisniety_przycisk = true
  9. miejsce_wcisniecia = get_global_mouse_position()
  10. if event.is_action_released("click") and wcisniety_przycisk:
  11. wcisniety_przycisk = false
  12. var miejsce_puszczenia = get_global_mouse_position()
  13. var kierunek = miejsce_wcisniecia - miejsce_puszczenia
  14. apply_impulse(Vector2(), kierunek * 5)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement