Advertisement
scolain

Untitled

Jan 13th, 2023 (edited)
1,871
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
GDScript 0.48 KB | Source Code | 0 0
  1. # ---- 2E COPIER-COLLER ----
  2.  
  3. func fire():
  4.     var bullet_instance = bullet.instance()
  5.     bullet_instance.position = get_global_position()
  6.     bullet_instance.rotation_degrees = rotation_degrees
  7.     bullet_instance.apply_impulse(Vector2(), Vector2(bullet_speed, 0).rotated(rotation))
  8.     get_tree().get_root().call_deferred("add_child", bullet_instance)
  9.  
  10. func kill():
  11.     var _tmp = get_tree().reload_current_scene()
  12.    
  13.  
  14. func _on_Area2D_body_entered(body:Node):
  15.     if "Enemy" in body.name:
  16.         kill()
Tags: Godot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement