Advertisement
otorp2

global pos bullet

Nov 23rd, 2015
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1.  
  2. extends Sprite
  3.  
  4. const SPEED = 15
  5. var dir
  6. var view_size
  7.  
  8. func fire(direction):
  9. dir = direction
  10. set_process(true)
  11.  
  12. func _ready():
  13. view_size = get_viewport_rect().size
  14.  
  15. func _process(delta):
  16. var pos = get_pos()
  17. set_pos(pos + dir* SPEED * delta)
  18. if abs(pos.x) > view_size.width/2 || abs(pos.y) > view_size.height/2:
  19. queue_free()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement