Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Sprite
- const SPEED = 15
- var dir
- var view_size
- func fire(direction):
- dir = direction
- set_process(true)
- func _ready():
- view_size = get_viewport_rect().size
- func _process(delta):
- var pos = get_pos()
- set_pos(pos + dir* SPEED * delta)
- if abs(pos.x) > view_size.width/2 || abs(pos.y) > view_size.height/2:
- queue_free()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement