Advertisement
otorp2

area2D connect and get_node("../enemy")

Apr 13th, 2016
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. extends Area2D
  2.  
  3.  
  4. var x = 0
  5.  
  6. func _ready():
  7. set_process(true)
  8. connect('area_enter',self,'_on_area_enter')
  9. var enemy_node = get_node("../enemy")
  10. print(enemy_node.get_pos())
  11.  
  12.  
  13. pass
  14.  
  15. func _process(delta):
  16. x += 1
  17. set_pos(Vector2(x,50))
  18.  
  19. func _on_area_enter( area ):
  20. print("hit")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement