ready for live testing!
This commit is contained in:
parent
42d238a2f8
commit
e3200c8416
5 changed files with 139 additions and 25 deletions
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=26 format=3 uid="uid://bdtfounpnyaoo"]
|
||||
[gd_scene load_steps=32 format=3 uid="uid://bdtfounpnyaoo"]
|
||||
|
||||
[ext_resource type="Script" path="res://twitch/jengacommands.gd" id="1_so2ke"]
|
||||
[ext_resource type="Script" path="res://scripts/JengaManager.gd" id="1_xtpjd"]
|
||||
|
|
@ -91,11 +91,38 @@ shader_parameter/surface_normals_b = SubResource("NoiseTexture2D_r4a3k")
|
|||
size = Vector3(1, 10, 3)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_y2xp5"]
|
||||
font_size = 10
|
||||
font_color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="Jenga" type="Node3D" node_paths=PackedStringArray("debug_ui_label")]
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_hb8hn"]
|
||||
font_size = 36
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_ks4vx"]
|
||||
offsets = PackedFloat32Array(0, 0.716578, 1)
|
||||
colors = PackedColorArray(0.34, 0.34, 0.34, 1, 0.395775, 0.376751, 0.330867, 1, 0.190762, 0.190762, 0.190762, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_op5ae"]
|
||||
gradient = SubResource("Gradient_ks4vx")
|
||||
fill_to = Vector2(0, 1)
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_a2577"]
|
||||
offsets = PackedFloat32Array(0, 0.759358, 1)
|
||||
colors = PackedColorArray(1, 0.858176, 0.22651, 1, 1, 0.77489, 0.23193, 1, 1, 0.425552, 0.254665, 1)
|
||||
|
||||
[sub_resource type="GradientTexture2D" id="GradientTexture2D_xmewu"]
|
||||
gradient = SubResource("Gradient_a2577")
|
||||
fill_to = Vector2(0, 1)
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_4ta2f"]
|
||||
font_color = Color(1, 0, 0, 1)
|
||||
|
||||
[node name="Jenga" type="Node3D" node_paths=PackedStringArray("debug_ui_label", "current_player_label", "next_up_label", "timer_bar", "turn_alert_label")]
|
||||
script = ExtResource("1_xtpjd")
|
||||
debug_ui_label = NodePath("UserInterface/DebugStuff")
|
||||
current_player_label = NodePath("UserInterface/GameUI/CurrentPlayerLabel")
|
||||
next_up_label = NodePath("UserInterface/GameUI/UpNextLabel")
|
||||
timer_bar = NodePath("UserInterface/GameUI/TurnTimeLimit")
|
||||
turn_alert_label = NodePath("UserInterface/GameUI/TurnTimeLimit/TurnAlert")
|
||||
|
||||
[node name="TwitchLink" type="Node" parent="." node_paths=PackedStringArray("jenga_manager")]
|
||||
script = ExtResource("1_so2ke")
|
||||
|
|
@ -170,7 +197,13 @@ size_flags_horizontal = 3
|
|||
layout_mode = 0
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
text = "meow"
|
||||
text = "Commands: !join_queue, !leave_queue
|
||||
On your turn:
|
||||
!start_turn - accept and begin your turn
|
||||
!move [north/south/east/west/up/down] [amount] - move the block
|
||||
!rotate [x/y/z] [degrees] - rotate the block
|
||||
!camera [left,right,up,down] - rotate or move the camera
|
||||
!drop - drop your block and end your turn (happens automatically if you run out of time!)"
|
||||
label_settings = SubResource("LabelSettings_y2xp5")
|
||||
|
||||
[node name="SubViewportContainer" type="SubViewportContainer" parent="UserInterface"]
|
||||
|
|
@ -282,6 +315,47 @@ text = "[b][font_size=30][color=red]X[/color]
|
|||
[/font_size][/b]"
|
||||
fit_content = true
|
||||
|
||||
[node name="GameUI" type="VBoxContainer" parent="UserInterface"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 12
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
|
||||
[node name="CurrentPlayerLabel" type="Label" parent="UserInterface/GameUI"]
|
||||
layout_mode = 2
|
||||
text = "Current Player: Clevertop"
|
||||
label_settings = SubResource("LabelSettings_hb8hn")
|
||||
|
||||
[node name="UpNextLabel" type="Label" parent="UserInterface/GameUI"]
|
||||
layout_mode = 2
|
||||
text = "Up next: Player1, Player2, Player3, Player 4"
|
||||
|
||||
[node name="TurnTimeLimit" type="TextureProgressBar" parent="UserInterface/GameUI"]
|
||||
custom_minimum_size = Vector2(0, 30.815)
|
||||
layout_mode = 2
|
||||
max_value = 1.0
|
||||
step = 0.0
|
||||
value = 0.72
|
||||
nine_patch_stretch = true
|
||||
texture_under = SubResource("GradientTexture2D_op5ae")
|
||||
texture_progress = SubResource("GradientTexture2D_xmewu")
|
||||
|
||||
[node name="TurnAlert" type="Label" parent="UserInterface/GameUI/TurnTimeLimit"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
text = "Type !start_turn || !move !rotate !camera !drop"
|
||||
label_settings = SubResource("LabelSettings_4ta2f")
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[connection signal="panic_drop" from="." to="PlayerHand" method="_on_jenga_panic_drop"]
|
||||
[connection signal="dropBlock" from="TwitchLink" to="." method="_on_twitch_link_drop_block"]
|
||||
[connection signal="dropBlock" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_drop_block"]
|
||||
[connection signal="moveBlock" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_move_block"]
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ extends Node3D
|
|||
|
||||
#region Variables
|
||||
#Signals
|
||||
signal panic_drop()
|
||||
|
||||
#Enums
|
||||
|
||||
|
|
@ -17,6 +18,11 @@ extends Node3D
|
|||
@export var accept_time_limit : float = 20
|
||||
@export_group("Node References")
|
||||
@export var debug_ui_label : Label
|
||||
@export_subgroup("GameUI")
|
||||
@export var current_player_label : Label
|
||||
@export var next_up_label: Label
|
||||
@export var timer_bar : TextureProgressBar
|
||||
@export var turn_alert_label : Label
|
||||
|
||||
#Onready Variables
|
||||
|
||||
|
|
@ -35,6 +41,9 @@ func _ready():
|
|||
|
||||
func _process(delta):
|
||||
turn_timer -= delta
|
||||
if(turn_timer<0 and turn_started):
|
||||
panic_drop.emit()
|
||||
turn_started = false
|
||||
if(current_player == "" or turn_timer<0):
|
||||
current_player = ""
|
||||
#switch to the next players turn (if anyone is in the queue)
|
||||
|
|
@ -43,12 +52,26 @@ func _process(delta):
|
|||
player_queue.erase(current_player)
|
||||
turn_started = false
|
||||
turn_timer = accept_time_limit
|
||||
debug_ui_label.text = "Current Player: " + current_player + "\nTurn Started?: " + str(turn_started) + "\nTime Left: " + str(round(turn_timer)) + "\nQueue Size: " + str(player_queue.size())
|
||||
#debug_ui_label.text = "Current Player: " + current_player + "\nTurn Started?: " + str(turn_started) + "\nTime Left: " + str(round(turn_timer)) + "\nQueue Size: " + str(player_queue.size())
|
||||
|
||||
current_player_label.text ="Current Player: " + current_player
|
||||
next_up_label.text = "Up Next: " + str(player_queue)
|
||||
|
||||
if(turn_timer < 0 && player_queue.size() == 0):
|
||||
turn_alert_label.text = "Type !join_queue to play"
|
||||
timer_bar.value = 0
|
||||
elif(turn_timer > 0 and not turn_started):
|
||||
turn_alert_label.text = current_player+ " you're up! Type !start_turn"
|
||||
timer_bar.value = turn_timer/ accept_time_limit
|
||||
elif(turn_timer > 0 and turn_started):
|
||||
turn_alert_label.text = "Use !move, !rotate, !camera and !drop to play your turn"
|
||||
timer_bar.value = turn_timer/ turn_time_limit
|
||||
|
||||
#endregion
|
||||
|
||||
#region Signal methods
|
||||
|
||||
func _on_twitch_link_drop_block():
|
||||
turn_timer = 0
|
||||
#endregion
|
||||
|
||||
#region Other methods (please try to separate and organise!)
|
||||
|
|
@ -58,5 +81,4 @@ func _process(delta):
|
|||
|
||||
|
||||
|
||||
func _on_twitch_link_drop_block():
|
||||
turn_timer = 0
|
||||
|
||||
|
|
|
|||
|
|
@ -32,25 +32,25 @@ func _ready():
|
|||
pass
|
||||
|
||||
func _process(delta):
|
||||
if abs(rotation_degrees.y - target_rotation) < 1:
|
||||
rotation_degrees.y = target_rotation
|
||||
else:
|
||||
if(target_rotation > rotation_degrees.y):
|
||||
rotation_degrees.y += rotation_speed * delta
|
||||
else:
|
||||
rotation_degrees.y -= rotation_speed * delta
|
||||
pass
|
||||
rotation_degrees.y= lerp(rotation_degrees.y, target_rotation, 0.1)
|
||||
|
||||
position.y = lerp(position.y, target_height, 0.1)
|
||||
|
||||
gizmo_pivot.rotation_degrees.y = rotation_degrees.y
|
||||
#endregion
|
||||
|
||||
#region Signal methods
|
||||
|
||||
func _on_twitch_link_rotate_camera(direction, amount):
|
||||
var dir
|
||||
var dir = 0
|
||||
var vert = 0
|
||||
match direction:
|
||||
"left" : dir = -1
|
||||
"right" : dir = 1
|
||||
"up" : vert = 1
|
||||
"down" : vert = -1
|
||||
target_rotation += dir * float(amount)
|
||||
target_height += vert * float(amount)
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ extends Node3D
|
|||
|
||||
#Other Variables (please try to separate and organise!)
|
||||
var current_block : RigidBody3D
|
||||
var tar_rotation : Vector3
|
||||
var tar_position : Vector3
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -31,7 +33,15 @@ var current_block : RigidBody3D
|
|||
func _ready():
|
||||
#Runs when all children have entered the tree
|
||||
pass
|
||||
|
||||
|
||||
func _process(delta):
|
||||
|
||||
#var target_vector = global_position.direction_to(player_position)
|
||||
#var target_basis= Basis.looking_at(target_vector)
|
||||
#basis = basis.slerp(target_basis, 0.5)
|
||||
rotation_degrees = lerp(rotation_degrees, tar_rotation, 0.1)
|
||||
position = lerp(position, tar_position, 0.1)
|
||||
gizmo_node.rotation_degrees = rotation_degrees
|
||||
#endregion
|
||||
|
||||
|
||||
|
|
@ -46,17 +56,20 @@ func _on_twitch_link_move_block(direction, amount):
|
|||
"east" : dir = Vector3.RIGHT
|
||||
"south" : dir = Vector3.BACK
|
||||
"west" : dir = Vector3.LEFT
|
||||
position += dir * amount * moveScale
|
||||
tar_position = position
|
||||
tar_position += dir * amount * moveScale
|
||||
#position += dir * amount * moveScale
|
||||
|
||||
|
||||
func _on_twitch_link_rotate_block(direction, amount):
|
||||
var dir : Vector3
|
||||
match direction:
|
||||
"x": dir = Vector3.RIGHT
|
||||
"y" : dir = Vector3.UP
|
||||
"z" : dir = Vector3.BACK
|
||||
rotation_degrees += dir * amount
|
||||
gizmo_node.rotation_degrees = rotation_degrees
|
||||
"x": dir.x = 1
|
||||
"y" : dir.y = 1
|
||||
"z" : dir.z = 1
|
||||
#rotation_degrees += dir * amount
|
||||
tar_rotation = rotation_degrees
|
||||
tar_rotation += dir * amount
|
||||
|
||||
func _on_twitch_link_drop_block():
|
||||
current_block.freeze = false
|
||||
|
|
@ -69,7 +82,9 @@ func _on_twitch_link_start_turn():
|
|||
current_block = block_scene.instantiate()
|
||||
current_block.freeze = true
|
||||
add_child(current_block)
|
||||
|
||||
|
||||
func _on_jenga_panic_drop():
|
||||
_on_twitch_link_drop_block()
|
||||
|
||||
|
||||
#endregion
|
||||
|
|
@ -83,3 +98,6 @@ func _on_twitch_link_start_turn():
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ func camera(cmd_info : CommandInfo, arg_ary : PackedStringArray) -> void:
|
|||
chat("moving camera " + arg_ary[0] + " by " + arg_ary[1] + " degrees")
|
||||
if(cmd_info.sender_data.tags["display-name"] == jenga_manager.current_player and jenga_manager.turn_started) :
|
||||
var chosenDirection = arg_ary[0].to_lower()
|
||||
var validDirections = ["left","right"]
|
||||
var validDirections = ["left","right","up","down"]
|
||||
if(validDirections.has(chosenDirection)):
|
||||
rotateCamera.emit(arg_ary[0],float(arg_ary[1]))
|
||||
chat("moving camera " + arg_ary[0] + " by " + arg_ary[1] + " degrees")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue