From 100d2affca0b281f41e12f394db803d8bd439f01 Mon Sep 17 00:00:00 2001 From: Just Dzhi Date: Mon, 2 Oct 2023 19:52:58 +0400 Subject: [PATCH] select card sound --- res/themes/default.tres | 1 + src/scenes/game/Game.tscn | 29 ++++++++++++++++++++--------- src/scenes/game/card_placeholder.gd | 3 ++- src/scenes/game/game.gd | 2 +- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/res/themes/default.tres b/res/themes/default.tres index f806a20..41f81a2 100644 --- a/res/themes/default.tres +++ b/res/themes/default.tres @@ -3,6 +3,7 @@ [ext_resource path="res://res/fonts/silkscreen/Silkscreen-Regular.ttf" type="DynamicFontData" id=1] [sub_resource type="DynamicFont" id=1] +size = 8 font_data = ExtResource( 1 ) [resource] diff --git a/src/scenes/game/Game.tscn b/src/scenes/game/Game.tscn index 4a47aea..710326d 100644 --- a/src/scenes/game/Game.tscn +++ b/src/scenes/game/Game.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=30 format=2] +[gd_scene load_steps=31 format=2] [ext_resource path="res://src/scenes/menu/background/background.png" type="Texture" id=1] [ext_resource path="res://src/scenes/game/sprites/background_houses.png" type="Texture" id=2] @@ -8,6 +8,7 @@ [ext_resource path="res://src/scenes/game/sprites/health/health.png" type="Texture" id=6] [ext_resource path="res://src/scenes/game/sprites/cast_time.png" type="Texture" id=7] [ext_resource path="res://src/scenes/game/card_placeholder.gd" type="Script" id=8] +[ext_resource path="res://res/sounds/card_select/card_select.ogg" type="AudioStream" id=9] [ext_resource path="res://src/scenes/game/sprites/player_icon.png" type="Texture" id=10] [ext_resource path="res://src/scenes/game/game.gd" type="Script" id=11] [ext_resource path="res://src/scenes/game/sprites/ui_background.png" type="Texture" id=12] @@ -29,14 +30,14 @@ extents = Vector2( 140, 10.125 ) atlas = ExtResource( 6 ) region = Rect2( 155, 0, 31, 11 ) -[sub_resource type="AtlasTexture" id=8] -atlas = ExtResource( 6 ) -region = Rect2( 124, 0, 31, 11 ) - [sub_resource type="AtlasTexture" id=9] atlas = ExtResource( 6 ) region = Rect2( 93, 0, 31, 11 ) +[sub_resource type="AtlasTexture" id=8] +atlas = ExtResource( 6 ) +region = Rect2( 124, 0, 31, 11 ) + [sub_resource type="AtlasTexture" id=10] atlas = ExtResource( 6 ) region = Rect2( 62, 0, 31, 11 ) @@ -51,10 +52,10 @@ region = Rect2( 0, 0, 31, 11 ) [sub_resource type="SpriteFrames" id=4] animations = [ { -"frames": [ SubResource( 7 ), SubResource( 8 ), SubResource( 9 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], -"loop": true, -"name": "default", -"speed": 5.0 +"frames": [ SubResource( 7 ), SubResource( 9 ), SubResource( 8 ), SubResource( 10 ), SubResource( 11 ), SubResource( 12 ) ], +"loop": false, +"name": "idle", +"speed": 0.0 } ] [sub_resource type="Animation" id=5] @@ -218,6 +219,7 @@ margin_bottom = 40.0 [node name="HealthSprite" type="AnimatedSprite" parent="UIWrapper/UI/Left/Health"] position = Vector2( 52, 156 ) frames = SubResource( 4 ) +animation = "idle" centered = false [node name="PlayerIcon" type="Sprite" parent="UIWrapper/UI/Left"] @@ -295,6 +297,9 @@ script = ExtResource( 8 ) [node name="Card" parent="UIWrapper/UI/Cards/LeftPlaceholder" instance=ExtResource( 18 )] +[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/LeftPlaceholder"] +stream = ExtResource( 9 ) + [node name="CenterPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]] margin_left = 113.0 margin_top = 8.0 @@ -306,6 +311,9 @@ id = 1 [node name="Card" parent="UIWrapper/UI/Cards/CenterPlaceholder" instance=ExtResource( 18 )] +[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/CenterPlaceholder"] +stream = ExtResource( 9 ) + [node name="RightPlaceholder" type="Control" parent="UIWrapper/UI/Cards" groups=["card_placeholder"]] margin_left = 218.0 margin_top = 8.0 @@ -317,6 +325,9 @@ id = 2 [node name="Card" parent="UIWrapper/UI/Cards/RightPlaceholder" instance=ExtResource( 18 )] +[node name="AudioCardSelect" type="AudioStreamPlayer" parent="UIWrapper/UI/Cards/RightPlaceholder"] +stream = ExtResource( 9 ) + [node name="Gameover" type="Control" parent="UIWrapper/UI"] margin_right = 320.0 margin_bottom = 180.0 diff --git a/src/scenes/game/card_placeholder.gd b/src/scenes/game/card_placeholder.gd index 02c8a58..b6bede1 100644 --- a/src/scenes/game/card_placeholder.gd +++ b/src/scenes/game/card_placeholder.gd @@ -9,10 +9,11 @@ func _process(delta): self.modulate = Color(1, 1, 1, 1) else: self.modulate = Color(0.2, 0.2, 0.2, 1) - + func _ready(): connect("mouse_entered", self, "select_hover", [self]) func select_hover(node): game.selected_card = id + $AudioCardSelect.play() diff --git a/src/scenes/game/game.gd b/src/scenes/game/game.gd index 956d7b2..8635432 100644 --- a/src/scenes/game/game.gd +++ b/src/scenes/game/game.gd @@ -14,7 +14,7 @@ var mob_threshold = [5, 7, 10, 7] func _ready(): Global.playing = true - Global.play_time = .0 + Global.play_time = 55.0 Global.health = 5 Global.add_health(0)