Compare commits
3 commits
0cd6bd6cd0
...
5c9580488b
| Author | SHA1 | Date | |
|---|---|---|---|
| 5c9580488b | |||
| 2be7d477fe | |||
| 832565d28a |
16 changed files with 167 additions and 9 deletions
|
|
@ -1,11 +1,17 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://d0iltvfnuao1q"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://d0iltvfnuao1q"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cj0cg8u5mclxe" path="res://numpad_button.gd" id="1_orrea"]
|
||||
[ext_resource type="AudioStream" uid="uid://ctkxotof2clun" path="res://assets/numpad/audio/click.wav" id="2_hixh2"]
|
||||
|
||||
[node name="TextureButton" type="TextureButton"]
|
||||
[node name="TextureButton" type="TextureButton" node_paths=PackedStringArray("audio_player")]
|
||||
script = ExtResource("1_orrea")
|
||||
audio_player = NodePath("AudioStreamPlayer2D")
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
region_enabled = true
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
stream = ExtResource("2_hixh2")
|
||||
volume_db = 2.385
|
||||
|
||||
[connection signal="button_down" from="." to="." method="_on_button_down"]
|
||||
|
|
|
|||
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/gavel.wav
Normal file
BIN
assets/gavel/audio/gavel.wav
Normal file
Binary file not shown.
24
assets/gavel/audio/gavel.wav.import
Normal file
24
assets/gavel/audio/gavel.wav.import
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://biyqgj25si2ei"
|
||||
path="res://.godot/imported/gavel.wav-d4bde5ab631cfe5dc6af9c2040fe18c7.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/gavel/audio/gavel.wav"
|
||||
dest_files=["res://.godot/imported/gavel.wav-d4bde5ab631cfe5dc6af9c2040fe18c7.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
|
||||
BIN
assets/numpad/audio/click.wav
Normal file
BIN
assets/numpad/audio/click.wav
Normal file
Binary file not shown.
24
assets/numpad/audio/click.wav.import
Normal file
24
assets/numpad/audio/click.wav.import
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
[remap]
|
||||
|
||||
importer="wav"
|
||||
type="AudioStreamWAV"
|
||||
uid="uid://ctkxotof2clun"
|
||||
path="res://.godot/imported/click.wav-4383acbd80dcc81771c497565ff896f2.sample"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/numpad/audio/click.wav"
|
||||
dest_files=["res://.godot/imported/click.wav-4383acbd80dcc81771c497565ff896f2.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_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:
|
||||
desk.numpad.ask_proposed.connect(_handle_ask_proposed)
|
||||
timer.timeout.connect(_handle_bid_delay_timeout)
|
||||
|
||||
func raise_paddle():
|
||||
#need to add in logic to animate paddle being raised
|
||||
bid_pending = true
|
||||
pass
|
||||
|
||||
func _handle_bid_delay_timeout():
|
||||
|
|
@ -35,6 +40,9 @@ func _handle_bid_delay_timeout():
|
|||
timer.stop()
|
||||
|
||||
func _handle_ask_proposed():
|
||||
if bid_pending:
|
||||
bid_pending = false
|
||||
|
||||
if randf() <= think_chance:
|
||||
timer.stop()
|
||||
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
|
||||
|
||||
@export var numpad: Numpad
|
||||
@export var game_manager: GameManager
|
||||
@export var turn_manager: TurnManager
|
||||
@export var audience_manager: AudienceManager
|
||||
|
||||
func _ready() -> void:
|
||||
numpad.turn_manager = turn_manager
|
||||
numpad.game_manager = game_manager
|
||||
numpad.audience_manager = audience_manager
|
||||
|
|
|
|||
26
desk.tscn
26
desk.tscn
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=30 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://d2ophrxm0wtr6" path="res://desk.gd" id="1_yugeg"]
|
||||
[ext_resource type="Script" uid="uid://l7wiwo13pb0f" path="res://numpad.gd" id="2_t5y75"]
|
||||
[ext_resource type="PackedScene" uid="uid://d0iltvfnuao1q" path="res://NumpadButton.tscn" id="3_se7ci"]
|
||||
[ext_resource type="Texture2D" uid="uid://cepssq6wpywy5" path="res://assets/numpad/zero.png" id="4_tm3w8"]
|
||||
[ext_resource type="AudioStream" uid="uid://biyqgj25si2ei" path="res://assets/gavel/audio/gavel.wav" id="5_ky68s"]
|
||||
[ext_resource type="Texture2D" uid="uid://wkwpo1utjk0q" path="res://assets/numpad/background.png" id="5_r8wvv"]
|
||||
[ext_resource type="Texture2D" uid="uid://bci1ygp5qx7r0" path="res://assets/numpad/zero-depressed.png" id="6_d0do2"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgrl7q65xeb7d" path="res://assets/numpad/one.png" id="7_yugeg"]
|
||||
|
|
@ -29,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://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="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")]
|
||||
layout_mode = 3
|
||||
|
|
@ -38,9 +41,10 @@ offset_bottom = 720.0
|
|||
script = ExtResource("1_yugeg")
|
||||
numpad = NodePath("Numpad")
|
||||
|
||||
[node name="Gavel" type="Node2D" parent="."]
|
||||
[node name="Gavel" type="Node2D" parent="." node_paths=PackedStringArray("audio_player")]
|
||||
position = Vector2(971, 563)
|
||||
script = ExtResource("1_ep8l3")
|
||||
audio_player = NodePath("GavelAudioPlayer")
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="Gavel"]
|
||||
offset_right = 40.0
|
||||
|
|
@ -48,10 +52,17 @@ offset_bottom = 40.0
|
|||
texture_normal = ExtResource("25_3ueqa")
|
||||
texture_pressed = ExtResource("26_e06cl")
|
||||
|
||||
[node name="Numpad" type="Node2D" parent="." node_paths=PackedStringArray("progress_bar")]
|
||||
[node name="GavelAudioPlayer" type="AudioStreamPlayer2D" parent="Gavel"]
|
||||
stream = ExtResource("5_ky68s")
|
||||
volume_db = 3.0
|
||||
|
||||
[node name="Numpad" type="Node2D" parent="." node_paths=PackedStringArray("progress_bar", "reminder_timer", "error_audio_player", "success_audio_player")]
|
||||
position = Vector2(640, 570)
|
||||
script = ExtResource("2_t5y75")
|
||||
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"]
|
||||
texture = ExtResource("5_r8wvv")
|
||||
|
|
@ -163,6 +174,15 @@ texture_normal = ExtResource("27_unpof")
|
|||
texture_pressed = ExtResource("28_4l1rv")
|
||||
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="."]
|
||||
layout_mode = 0
|
||||
offset_left = 477.0
|
||||
|
|
|
|||
3
gavel.gd
3
gavel.gd
|
|
@ -6,7 +6,9 @@ var swinging
|
|||
var click_radius = 32 # will need to determine click radius based on sprite size -- should be equal
|
||||
var swing_threshold = 64 # will also need to scale this based on sprite size
|
||||
var swing_start = Vector2(0, 0)
|
||||
|
||||
@export var gavel_root_position = Vector2(0, 0)
|
||||
@export var audio_player: AudioStreamPlayer2D
|
||||
|
||||
#func _input(event: InputEvent) -> void:
|
||||
#if event is InputEventMouseButton and event.button_index == MOUSE_BUTTON_LEFT:
|
||||
|
|
@ -26,4 +28,5 @@ var swing_start = Vector2(0, 0)
|
|||
|
||||
|
||||
func _on_texture_button_button_down() -> void:
|
||||
audio_player.play()
|
||||
gavel_hit.emit()
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@ texture = ExtResource("3_272bh")
|
|||
[node name="GameManager" type="Node2D" parent="."]
|
||||
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")
|
||||
audience_manager = NodePath("../AudienceManager")
|
||||
|
||||
[node name="AudienceManager" parent="." node_paths=PackedStringArray("desk", "game_manager") instance=ExtResource("6_272bh")]
|
||||
desk = NodePath("../Desk")
|
||||
|
|
|
|||
20
numpad.gd
20
numpad.gd
|
|
@ -4,12 +4,21 @@ var numpad_buffer = Array()
|
|||
var proposed_ask: int
|
||||
signal ask_proposed
|
||||
|
||||
#var turn_manager: TurnManager
|
||||
var audience_manager: AudienceManager
|
||||
var game_manager: GameManager
|
||||
var turn_manager: TurnManager
|
||||
|
||||
@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:
|
||||
progress_bar.value = (turn_manager.timer.time_left/turn_manager.timer.wait_time) * 100
|
||||
print(str(progress_bar.value) + " " + str(turn_manager.timer.time_left) + " " + str(turn_manager.timer.wait_time))
|
||||
progress_bar.value = reminder_timer.time_left
|
||||
|
||||
# number entry function called by numbered button children
|
||||
func keypad_entry(entry: int):
|
||||
|
|
@ -21,5 +30,12 @@ func keypad_backspace():
|
|||
func keypad_submit():
|
||||
var keypad_output: String = "".join(numpad_buffer)
|
||||
proposed_ask = int(keypad_output) * 1000
|
||||
|
||||
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()
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ extends TextureButton
|
|||
@export var button_value = 0
|
||||
@export var button_texture: Texture2D
|
||||
@export var button_region: Rect2
|
||||
@export var audio_player: AudioStreamPlayer2D
|
||||
|
||||
@onready var parent: Numpad = get_parent()
|
||||
|
||||
|
|
@ -12,6 +13,8 @@ func _ready() -> void:
|
|||
|
||||
|
||||
func _on_button_down() -> void:
|
||||
audio_player.play()
|
||||
|
||||
if button_value <= 9:
|
||||
parent.keypad_entry(button_value)
|
||||
elif button_value == 10:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue