Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const SPEED=-220
- const SHOOT_INTERVAL=1
- var shoot_timeout=0
- func _process(delta):
- translate( Vector2(SPEED*delta,0) )
- shoot_timeout-=delta
- if (shoot_timeout<0):
- shoot_timeout=SHOOT_INTERVAL
- #instance a shot
- var shot = preload("res://enemy_shot.scn").instance()
- #set pos as "shoot_from" Position2D node
- shot.set_pos( get_node("shoot_from").get_global_pos() )
- #add it to parent, so it has world coordinates
- get_parent().add_child(shot)
- var destroyed=false
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement