Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var intervalo = .3
- var laser_h = 54
- var pre_tiro = preload("res://scenes/shoot.tscn") #precarrega a cena shoot
- var nave
- func _init(nave):
- self.nave = nave
- func disparar():
- instanciarProjetil("naveImg/canhaoE/Position2D")
- instanciarProjetil("naveImg/canhaoD/Position2D")
- intervalo = .3
- func verificaIntervalo(delta):
- if intervalo >= 0:
- intervalo -= delta
- func instanciarProjetil(node):
- var tiro = pre_tiro.instance() #instancia a cena tiro
- tiro.set_global_position(self.nave.get_node(node).get_global_position() - Vector2(0,laser_h/2))
- self.nave.get_owner().add_child(tiro)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement