Szczepan86

[godot] pierwszy projekt

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