diff --git a/scenes/ship.tscn b/scenes/ship.tscn index 703fa78..7886491 100644 --- a/scenes/ship.tscn +++ b/scenes/ship.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" path="res://scripts/ship.gd" id="1_japvq"] [ext_resource type="Texture2D" uid="uid://qcnuvee2jcp0" path="res://assets/img/ship.png" id="1_ymcdl"] [ext_resource type="AudioStream" uid="uid://cg6v2xvf4jkkv" path="res://assets/sfx/shoot.wav" id="3_kvryg"] -[ext_resource type="AudioStream" uid="uid://cycpanck51dqd" path="res://assets/sfx/explosion.wav" id="4_gdodt"] +[ext_resource type="AudioStream" uid="uid://cycpanck51dqd" path="res://assets/sfx/crash.wav" id="4_i4skj"] [sub_resource type="Animation" id="Animation_qfhr1"] length = 0.001 @@ -86,7 +86,7 @@ position = Vector2(0, -33) stream = ExtResource("3_kvryg") [node name="CrashSound" type="AudioStreamPlayer" parent="."] -stream = ExtResource("4_gdodt") +stream = ExtResource("4_i4skj") [node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { diff --git a/scripts/ship.gd b/scripts/ship.gd index 4249390..638b32e 100644 --- a/scripts/ship.gd +++ b/scripts/ship.gd @@ -4,6 +4,8 @@ extends CharacterBody2D # FIXME: Tweak speed and shoot time values # FIXME: Tweak Ship's scale +signal crashed + const BULLET = preload("res://scenes/bullet.tscn") @export var accleration := 90.0 @@ -47,8 +49,8 @@ func fire_gun(pos : Vector2, rot : float) -> void: $ShotCooldown.start() func crash(): - # TODO: Maybe emit a signal that the main game node listens for "game over" state # TODO: Make some kind of crash animation or crashed sprite + crashed.emit() $AnimationPlayer.play("crash")