Advertisement
rodrigofbm

TiroDuplo

Jan 28th, 2018
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. var intervalo = .3
  2. var laser_h = 54
  3. var pre_tiro = preload("res://scenes/shoot.tscn") #precarrega a cena shoot
  4. var nave
  5.  
  6. func _init(nave):
  7.     self.nave = nave
  8.  
  9. func disparar():
  10.     instanciarProjetil("naveImg/canhaoE/Position2D")
  11.     instanciarProjetil("naveImg/canhaoD/Position2D")
  12.     intervalo = .3
  13.    
  14. func verificaIntervalo(delta):
  15.     if intervalo >= 0:
  16.         intervalo -= delta
  17.        
  18. func instanciarProjetil(node):
  19.     var tiro = pre_tiro.instance() #instancia a cena tiro
  20.     tiro.set_global_position(self.nave.get_node(node).get_global_position() - Vector2(0,laser_h/2))
  21.     self.nave.get_owner().add_child(tiro)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement