ready for live testing!
This commit is contained in:
parent
42d238a2f8
commit
e3200c8416
5 changed files with 139 additions and 25 deletions
|
|
@ -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():
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue