Advertisement
otorp2

global pos rotate turret add_child bullet

Nov 22nd, 2015
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1.  
  2. extends Sprite
  3.  
  4. func _ready():
  5.  
  6. set_process_input(true)
  7. pass
  8.  
  9. func _input(event):
  10. if Input.is_action_pressed("ui_left"):
  11. set_rot(get_rot() +.785398)
  12. if Input.is_action_pressed("ui_right"):
  13. set_rot(get_rot() -.785398)
  14.  
  15.  
  16. if Input.is_action_pressed("ui_down"):
  17. var bullet = preload("res://bullet.scn").instance()
  18. var dir = get_node("shootto").get_global_pos() - get_node("shootfrom").get_global_pos()
  19. bullet.fire(dir)
  20. get_parent().add_child(bullet)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement