Game #3: Space Shooter
This commit is contained in:
parent
a00e9b59c9
commit
f785a24c14
45 changed files with 927 additions and 0 deletions
18
space-shooter/Scenes/Objects/Bullet.gd
Normal file
18
space-shooter/Scenes/Objects/Bullet.gd
Normal file
|
@ -0,0 +1,18 @@
|
|||
extends RigidBody2D
|
||||
|
||||
|
||||
const LaserHit = preload("res://Scenes/LaserHit.tscn")
|
||||
|
||||
onready var laserSound = $LaserSound
|
||||
|
||||
func _ready():
|
||||
laserSound.play()
|
||||
|
||||
func _on_VisibilityNotifier2D_screen_exited():
|
||||
queue_free()
|
||||
|
||||
func create_hit_effect():
|
||||
var hit = LaserHit.instance()
|
||||
hit.global_position = global_position
|
||||
hit.get_node("HitParticles").emitting = true
|
||||
get_tree().current_scene.add_child(hit)
|
Loading…
Add table
Add a link
Reference in a new issue