Skip to content

Commit

Permalink
Added Game Over sound
Browse files Browse the repository at this point in the history
  • Loading branch information
Plexi09 committed May 29, 2024
1 parent 5842f49 commit 7dd5e27
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 6 deletions.
Binary file added assets/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions assets/background.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[remap]

importer="texture"
type="CompressedTexture2D"
uid="uid:https://rj1egjy08v5v"
path="res:https://.godot/imported/background.png-1fdba8b6a966ce2c2ffc607f7c096e95.ctex"
metadata={
"vram_texture": false
}

[deps]

source_file="res:https://assets/background.png"
dest_files=["res:https://.godot/imported/background.png-1fdba8b6a966ce2c2ffc607f7c096e95.ctex"]

[params]

compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file added assets/music/gameover.mp3
Binary file not shown.
19 changes: 19 additions & 0 deletions assets/music/gameover.mp3.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[remap]

importer="mp3"
type="AudioStreamMP3"
uid="uid:https://c40i0yp6q2v86"
path="res:https://.godot/imported/gameover.mp3-dd9f3281cbcb32c7580308236ca45e9d.mp3str"

[deps]

source_file="res:https://assets/music/gameover.mp3"
dest_files=["res:https://.godot/imported/gameover.mp3-dd9f3281cbcb32c7580308236ca45e9d.mp3str"]

[params]

loop=false
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4
4 changes: 2 additions & 2 deletions assets/music/time_for_adventure.mp3.import
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dest_files=["res:https://.godot/imported/time_for_adventure.mp3-b8a49ae1cfc83b211be9d8
[params]

loop=false
loop_offset=0
bpm=0
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4
20 changes: 18 additions & 2 deletions scenes/game.tscn
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[gd_scene load_steps=10 format=3 uid="uid:https://bu7kgrg5m047b"]
[gd_scene load_steps=13 format=3 uid="uid:https://bu7kgrg5m047b"]

[ext_resource type="PackedScene" uid="uid:https://dbd21fr1athct" path="res:https://scenes/player.tscn" id="1_xggnn"]
[ext_resource type="Texture2D" uid="uid:https://ca57krj641oui" path="res:https://assets/sprites/world_tileset.png" id="2_0rv7l"]
[ext_resource type="PackedScene" uid="uid:https://dxtanox1pnxnx" path="res:https://scenes/platform.tscn" id="3_ldhqo"]
[ext_resource type="PackedScene" uid="uid:https://cvo47d5omr7wj" path="res:https://scenes/coin.tscn" id="4_cfox4"]
[ext_resource type="PackedScene" uid="uid:https://qswi05h5wpxg" path="res:https://scenes/killzone.tscn" id="5_4j45q"]
[ext_resource type="AudioStream" uid="uid:https://c40i0yp6q2v86" path="res:https://assets/music/gameover.mp3" id="6_1qamm"]

[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_ovqm5"]
texture = ExtResource("2_0rv7l")
Expand Down Expand Up @@ -445,6 +447,9 @@ _data = {
"move": SubResource("Animation_dfkay")
}

[sub_resource type="WorldBoundaryShape2D" id="WorldBoundaryShape2D_57k1x"]
distance = -118.0

[node name="Game" type="Node2D"]

[node name="TileMap" type="TileMap" parent="."]
Expand All @@ -458,7 +463,10 @@ position = Vector2(-52, 3)

[node name="Camera2D" type="Camera2D" parent="Player"]
position = Vector2(0, -6)
scale = Vector2(0.963138, -391.524)
zoom = Vector2(4, 4)
limit_bottom = 120
limit_smoothed = true
position_smoothing_enabled = true

[node name="Platform" parent="." instance=ExtResource("3_ldhqo")]
Expand All @@ -480,10 +488,18 @@ position = Vector2(251, 19)
position = Vector2(-5, -45)

[node name="Coin3" parent="." instance=ExtResource("4_cfox4")]
position = Vector2(-5, 36)
position = Vector2(-5, 35)

[node name="Coin4" parent="." instance=ExtResource("4_cfox4")]
position = Vector2(344, -1)

[node name="Coin5" parent="." instance=ExtResource("4_cfox4")]
position = Vector2(443, 19)

[node name="Killzone" parent="." instance=ExtResource("5_4j45q")]

[node name="CollisionShape2D" type="CollisionShape2D" parent="Killzone"]
shape = SubResource("WorldBoundaryShape2D_57k1x")

[node name="GameOver" type="AudioStreamPlayer" parent="Killzone"]
stream = ExtResource("6_1qamm")
16 changes: 15 additions & 1 deletion scenes/killzone.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
[gd_scene format=3 uid="uid:https://qswi05h5wpxg"]
[gd_scene load_steps=3 format=3 uid="uid:https://qswi05h5wpxg"]

[ext_resource type="Script" path="res:https://scripts/killzone.gd" id="1_yoik7"]
[ext_resource type="AudioStream" uid="uid:https://c40i0yp6q2v86" path="res:https://assets/music/gameover.mp3" id="2_50m4v"]

[node name="Killzone" type="Area2D"]
collision_mask = 2
script = ExtResource("1_yoik7")

[node name="Timer" type="Timer" parent="."]
wait_time = 5.689
one_shot = true

[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."]
stream = ExtResource("2_50m4v")

[connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
2 changes: 1 addition & 1 deletion scripts/coin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ extends Area2D


func _on_body_entered(body):
pass # Replace with function body.
queue_free()
11 changes: 11 additions & 0 deletions scripts/killzone.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends Area2D

@onready var timer = $Timer
@onready var audio_player = $AudioStreamPlayer

func _on_body_entered(body):
timer.start()
audio_player.play()

func _on_timer_timeout():
get_tree().reload_current_scene()

0 comments on commit 7dd5e27

Please sign in to comment.