mirror of
https://codeberg.org/Melon-Bread/Comets.gd.git
synced 2024-11-24 21:18:21 -05:00
Player crash when hit comet
This commit is contained in:
parent
41dc281b66
commit
c7ce3be782
BIN
assets/sfx/explosion.wav
Normal file
BIN
assets/sfx/explosion.wav
Normal file
Binary file not shown.
24
assets/sfx/explosion.wav.import
Normal file
24
assets/sfx/explosion.wav.import
Normal file
@ -0,0 +1,24 @@
|
||||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://cycpanck51dqd"
|
||||
path="res://.godot/imported/explosion.wav-e1f35b1a1dc4bf25a23a1f22f1673be5.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/sfx/explosion.wav"
|
||||
dest_files=["res://.godot/imported/explosion.wav-e1f35b1a1dc4bf25a23a1f22f1673be5.sample"]
|
||||
|
||||
[params]
|
||||
|
||||
force/8_bit=false
|
||||
force/mono=false
|
||||
force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=0
|
@ -12,3 +12,11 @@ func _ready() -> void:
|
||||
func _physics_process(delta: float) -> void:
|
||||
rotate(deg_to_rad(rotaion_direction * rotation_speed * delta))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_body_entered(body: Node2D) -> void:
|
||||
print(body)
|
||||
if body.is_in_group("ship"):
|
||||
body.crash()
|
||||
|
@ -11,3 +11,5 @@ texture = ExtResource("1_6q67h")
|
||||
|
||||
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
|
||||
polygon = PackedVector2Array(19, -27, 22, -25, 25, -24, 27, -21, 31, -17, 32, -3, 32, 27, 27, 30, -8, 29, -17, 28, -25, 26, -32, 22, -32, 18, -23, 8, -20, 7, -21, 2, -29, -17, -29, -26, -27, -29, -25, -32, -14, -32, 0, -30)
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
|
@ -1,8 +1,59 @@
|
||||
[gd_scene load_steps=4 format=3 uid="uid://cbo47ftx0vcro"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://cbo47ftx0vcro"]
|
||||
|
||||
[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"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ctlro"]
|
||||
resource_name = "crash"
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("CrashSound:playing")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "method"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath(".")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0.6),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"queue_free"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_qfhr1"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("CrashSound:playing")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_3jmf3"]
|
||||
_data = {
|
||||
"RESET": SubResource("Animation_qfhr1"),
|
||||
"crash": SubResource("Animation_ctlro")
|
||||
}
|
||||
|
||||
[node name="Ship" type="CharacterBody2D" groups=["ship"]]
|
||||
collision_mask = 2
|
||||
@ -34,4 +85,12 @@ position = Vector2(0, -33)
|
||||
[node name="ShootSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("3_kvryg")
|
||||
|
||||
[node name="CrashSound" type="AudioStreamPlayer" parent="."]
|
||||
stream = ExtResource("4_gdodt")
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
libraries = {
|
||||
"": SubResource("AnimationLibrary_3jmf3")
|
||||
}
|
||||
|
||||
[connection signal="timeout" from="ShotCooldown" to="." method="_on_shot_cooldown_timeout"]
|
||||
|
@ -42,5 +42,9 @@ func fire_gun(pos : Vector2, rot : float) -> void:
|
||||
can_shoot = false
|
||||
$ShotCooldown.start()
|
||||
|
||||
func crash():
|
||||
$AnimationPlayer.play("crash")
|
||||
|
||||
|
||||
func _on_shot_cooldown_timeout() -> void:
|
||||
can_shoot = true
|
||||
|
Loading…
Reference in New Issue
Block a user