Update ship.tscn and ship.gd

This commit is contained in:
Rain Clark 2024-05-12 22:37:25 -04:00
parent fb60dfce61
commit 1d5df2b795
2 changed files with 5 additions and 3 deletions

View File

@ -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 = {

View File

@ -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")