add keypad success and error noises
This commit is contained in:
parent
2be7d477fe
commit
5c9580488b
9 changed files with 99 additions and 6 deletions
BIN
assets/gavel/audio/ask-bet.wav
Normal file
BIN
assets/gavel/audio/ask-bet.wav
Normal file
Binary file not shown.
24
assets/gavel/audio/ask-bet.wav.import
Normal file
24
assets/gavel/audio/ask-bet.wav.import
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://b7qyt2h17kjea"
|
||||||
|
path="res://.godot/imported/ask-bet.wav-864c7fec670ad7b7f78e498c2cc328c4.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/gavel/audio/ask-bet.wav"
|
||||||
|
dest_files=["res://.godot/imported/ask-bet.wav-864c7fec670ad7b7f78e498c2cc328c4.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=2
|
||||||
BIN
assets/gavel/audio/invalid-bet.wav
Normal file
BIN
assets/gavel/audio/invalid-bet.wav
Normal file
Binary file not shown.
24
assets/gavel/audio/invalid-bet.wav.import
Normal file
24
assets/gavel/audio/invalid-bet.wav.import
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="wav"
|
||||||
|
type="AudioStreamWAV"
|
||||||
|
uid="uid://bvto7ghmy8j0o"
|
||||||
|
path="res://.godot/imported/invalid-bet.wav-17c60220cddd9dec8f96fac985ac4096.sample"
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/gavel/audio/invalid-bet.wav"
|
||||||
|
dest_files=["res://.godot/imported/invalid-bet.wav-17c60220cddd9dec8f96fac985ac4096.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=2
|
||||||
|
|
@ -19,12 +19,17 @@ signal ask_accepted
|
||||||
@export var think_min_time := 1.0
|
@export var think_min_time := 1.0
|
||||||
@export var think_max_time := 5.0
|
@export var think_max_time := 5.0
|
||||||
|
|
||||||
|
# Whether or not the audience has submitted a bid, and the next call
|
||||||
|
# needs to be higher than the last
|
||||||
|
var bid_pending = false
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
desk.numpad.ask_proposed.connect(_handle_ask_proposed)
|
desk.numpad.ask_proposed.connect(_handle_ask_proposed)
|
||||||
timer.timeout.connect(_handle_bid_delay_timeout)
|
timer.timeout.connect(_handle_bid_delay_timeout)
|
||||||
|
|
||||||
func raise_paddle():
|
func raise_paddle():
|
||||||
#need to add in logic to animate paddle being raised
|
#need to add in logic to animate paddle being raised
|
||||||
|
bid_pending = true
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _handle_bid_delay_timeout():
|
func _handle_bid_delay_timeout():
|
||||||
|
|
@ -35,6 +40,9 @@ func _handle_bid_delay_timeout():
|
||||||
timer.stop()
|
timer.stop()
|
||||||
|
|
||||||
func _handle_ask_proposed():
|
func _handle_ask_proposed():
|
||||||
|
if bid_pending:
|
||||||
|
bid_pending = false
|
||||||
|
|
||||||
if randf() <= think_chance:
|
if randf() <= think_chance:
|
||||||
timer.stop()
|
timer.stop()
|
||||||
var ask_duration: float = randf_range(1.0, 5.0)
|
var ask_duration: float = randf_range(1.0, 5.0)
|
||||||
|
|
|
||||||
4
desk.gd
4
desk.gd
|
|
@ -1,7 +1,11 @@
|
||||||
class_name Desk extends Control
|
class_name Desk extends Control
|
||||||
|
|
||||||
@export var numpad: Numpad
|
@export var numpad: Numpad
|
||||||
|
@export var game_manager: GameManager
|
||||||
@export var turn_manager: TurnManager
|
@export var turn_manager: TurnManager
|
||||||
|
@export var audience_manager: AudienceManager
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
numpad.turn_manager = turn_manager
|
numpad.turn_manager = turn_manager
|
||||||
|
numpad.game_manager = game_manager
|
||||||
|
numpad.audience_manager = audience_manager
|
||||||
|
|
|
||||||
19
desk.tscn
19
desk.tscn
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=31 format=3 uid="uid://bohp0o2smdkwe"]
|
[gd_scene load_steps=33 format=3 uid="uid://bohp0o2smdkwe"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://c2mrlu8d75ry4" path="res://gavel.gd" id="1_ep8l3"]
|
[ext_resource type="Script" uid="uid://c2mrlu8d75ry4" path="res://gavel.gd" id="1_ep8l3"]
|
||||||
[ext_resource type="Script" uid="uid://d2ophrxm0wtr6" path="res://desk.gd" id="1_yugeg"]
|
[ext_resource type="Script" uid="uid://d2ophrxm0wtr6" path="res://desk.gd" id="1_yugeg"]
|
||||||
|
|
@ -30,6 +30,8 @@
|
||||||
[ext_resource type="Texture2D" uid="uid://b5ijw66s6ibkb" path="res://assets/numpad/backspace-depressed.png" id="26_e06cl"]
|
[ext_resource type="Texture2D" uid="uid://b5ijw66s6ibkb" path="res://assets/numpad/backspace-depressed.png" id="26_e06cl"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bwhf5712gd67h" path="res://assets/numpad/ask.png" id="27_unpof"]
|
[ext_resource type="Texture2D" uid="uid://bwhf5712gd67h" path="res://assets/numpad/ask.png" id="27_unpof"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cxwxmqnnbyl3s" path="res://assets/numpad/ask-depressed.png" id="28_4l1rv"]
|
[ext_resource type="Texture2D" uid="uid://cxwxmqnnbyl3s" path="res://assets/numpad/ask-depressed.png" id="28_4l1rv"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://bvto7ghmy8j0o" path="res://assets/gavel/audio/invalid-bet.wav" id="31_v5y5a"]
|
||||||
|
[ext_resource type="AudioStream" uid="uid://b7qyt2h17kjea" path="res://assets/gavel/audio/ask-bet.wav" id="32_dnpqj"]
|
||||||
|
|
||||||
[node name="Desk" type="Control" node_paths=PackedStringArray("numpad")]
|
[node name="Desk" type="Control" node_paths=PackedStringArray("numpad")]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
|
@ -52,11 +54,15 @@ texture_pressed = ExtResource("26_e06cl")
|
||||||
|
|
||||||
[node name="GavelAudioPlayer" type="AudioStreamPlayer2D" parent="Gavel"]
|
[node name="GavelAudioPlayer" type="AudioStreamPlayer2D" parent="Gavel"]
|
||||||
stream = ExtResource("5_ky68s")
|
stream = ExtResource("5_ky68s")
|
||||||
|
volume_db = 3.0
|
||||||
|
|
||||||
[node name="Numpad" type="Node2D" parent="." node_paths=PackedStringArray("progress_bar")]
|
[node name="Numpad" type="Node2D" parent="." node_paths=PackedStringArray("progress_bar", "reminder_timer", "error_audio_player", "success_audio_player")]
|
||||||
position = Vector2(640, 570)
|
position = Vector2(640, 570)
|
||||||
script = ExtResource("2_t5y75")
|
script = ExtResource("2_t5y75")
|
||||||
progress_bar = NodePath("../ProgressBar")
|
progress_bar = NodePath("../ProgressBar")
|
||||||
|
reminder_timer = NodePath("ReminderTimer")
|
||||||
|
error_audio_player = NodePath("ErrorSoundPlayer")
|
||||||
|
success_audio_player = NodePath("SuccessSoundPlayer")
|
||||||
|
|
||||||
[node name="Sprite2D" type="Sprite2D" parent="Numpad"]
|
[node name="Sprite2D" type="Sprite2D" parent="Numpad"]
|
||||||
texture = ExtResource("5_r8wvv")
|
texture = ExtResource("5_r8wvv")
|
||||||
|
|
@ -168,6 +174,15 @@ texture_normal = ExtResource("27_unpof")
|
||||||
texture_pressed = ExtResource("28_4l1rv")
|
texture_pressed = ExtResource("28_4l1rv")
|
||||||
button_value = 11
|
button_value = 11
|
||||||
|
|
||||||
|
[node name="ReminderTimer" type="Timer" parent="Numpad"]
|
||||||
|
wait_time = 7.0
|
||||||
|
|
||||||
|
[node name="ErrorSoundPlayer" type="AudioStreamPlayer2D" parent="Numpad"]
|
||||||
|
stream = ExtResource("31_v5y5a")
|
||||||
|
|
||||||
|
[node name="SuccessSoundPlayer" type="AudioStreamPlayer2D" parent="Numpad"]
|
||||||
|
stream = ExtResource("32_dnpqj")
|
||||||
|
|
||||||
[node name="ProgressBar" type="ProgressBar" parent="."]
|
[node name="ProgressBar" type="ProgressBar" parent="."]
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_left = 477.0
|
offset_left = 477.0
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,10 @@ texture = ExtResource("3_272bh")
|
||||||
[node name="GameManager" type="Node2D" parent="."]
|
[node name="GameManager" type="Node2D" parent="."]
|
||||||
script = ExtResource("1_ig7tw")
|
script = ExtResource("1_ig7tw")
|
||||||
|
|
||||||
[node name="Desk" parent="." node_paths=PackedStringArray("turn_manager") instance=ExtResource("2_0xm2m")]
|
[node name="Desk" parent="." node_paths=PackedStringArray("game_manager", "turn_manager", "audience_manager") instance=ExtResource("2_0xm2m")]
|
||||||
|
game_manager = NodePath("../GameManager")
|
||||||
turn_manager = NodePath("../TurnManager")
|
turn_manager = NodePath("../TurnManager")
|
||||||
|
audience_manager = NodePath("../AudienceManager")
|
||||||
|
|
||||||
[node name="AudienceManager" parent="." node_paths=PackedStringArray("desk", "game_manager") instance=ExtResource("6_272bh")]
|
[node name="AudienceManager" parent="." node_paths=PackedStringArray("desk", "game_manager") instance=ExtResource("6_272bh")]
|
||||||
desk = NodePath("../Desk")
|
desk = NodePath("../Desk")
|
||||||
|
|
|
||||||
22
numpad.gd
22
numpad.gd
|
|
@ -4,12 +4,21 @@ var numpad_buffer = Array()
|
||||||
var proposed_ask: int
|
var proposed_ask: int
|
||||||
signal ask_proposed
|
signal ask_proposed
|
||||||
|
|
||||||
|
#var turn_manager: TurnManager
|
||||||
|
var audience_manager: AudienceManager
|
||||||
|
var game_manager: GameManager
|
||||||
var turn_manager: TurnManager
|
var turn_manager: TurnManager
|
||||||
|
|
||||||
@export var progress_bar: ProgressBar
|
@export var progress_bar: ProgressBar
|
||||||
|
@export var reminder_timer: Timer
|
||||||
|
@export var error_audio_player: AudioStreamPlayer2D
|
||||||
|
@export var success_audio_player: AudioStreamPlayer2D
|
||||||
|
|
||||||
|
func _ready() -> void:
|
||||||
|
progress_bar.max_value = reminder_timer.wait_time
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
progress_bar.value = (turn_manager.timer.time_left/turn_manager.timer.wait_time) * 100
|
progress_bar.value = reminder_timer.time_left
|
||||||
print(str(progress_bar.value) + " " + str(turn_manager.timer.time_left) + " " + str(turn_manager.timer.wait_time))
|
|
||||||
|
|
||||||
# number entry function called by numbered button children
|
# number entry function called by numbered button children
|
||||||
func keypad_entry(entry: int):
|
func keypad_entry(entry: int):
|
||||||
|
|
@ -21,5 +30,12 @@ func keypad_backspace():
|
||||||
func keypad_submit():
|
func keypad_submit():
|
||||||
var keypad_output: String = "".join(numpad_buffer)
|
var keypad_output: String = "".join(numpad_buffer)
|
||||||
proposed_ask = int(keypad_output) * 1000
|
proposed_ask = int(keypad_output) * 1000
|
||||||
ask_proposed.emit()
|
|
||||||
|
if proposed_ask > game_manager.current_bid and audience_manager.bid_pending or proposed_ask == game_manager.current_bid:
|
||||||
|
success_audio_player.play()
|
||||||
|
ask_proposed.emit()
|
||||||
|
else:
|
||||||
|
error_audio_player.play()
|
||||||
|
|
||||||
|
reminder_timer.start(-1)
|
||||||
numpad_buffer.clear()
|
numpad_buffer.clear()
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue