dynamic spawn position based on tower i *think* its working now
This commit is contained in:
parent
e3200c8416
commit
c9a7e252e7
5 changed files with 40 additions and 5 deletions
|
|
@ -1,2 +1,3 @@
|
||||||
# TwitchPlaysReverseJenga
|
# TwitchPlaysReverseJenga
|
||||||
a chaotic idea
|
a chaotic little game that I play with friends and turned intoa twitch plays asa challenge!
|
||||||
|
Official Channel: https://www.twitch.tv/twitchplaysreversejenga
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=32 format=3 uid="uid://bdtfounpnyaoo"]
|
[gd_scene load_steps=33 format=3 uid="uid://bdtfounpnyaoo"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://twitch/jengacommands.gd" id="1_so2ke"]
|
[ext_resource type="Script" path="res://twitch/jengacommands.gd" id="1_so2ke"]
|
||||||
[ext_resource type="Script" path="res://scripts/JengaManager.gd" id="1_xtpjd"]
|
[ext_resource type="Script" path="res://scripts/JengaManager.gd" id="1_xtpjd"]
|
||||||
|
|
@ -87,6 +87,9 @@ shader_parameter/wave_b = SubResource("NoiseTexture2D_2unhc")
|
||||||
shader_parameter/surface_normals_a = SubResource("NoiseTexture2D_ptjyb")
|
shader_parameter/surface_normals_a = SubResource("NoiseTexture2D_ptjyb")
|
||||||
shader_parameter/surface_normals_b = SubResource("NoiseTexture2D_r4a3k")
|
shader_parameter/surface_normals_b = SubResource("NoiseTexture2D_r4a3k")
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_dk6bf"]
|
||||||
|
size = Vector3(1, 0.59, 3)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_gmpx6"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_gmpx6"]
|
||||||
size = Vector3(1, 10, 3)
|
size = Vector3(1, 10, 3)
|
||||||
|
|
||||||
|
|
@ -154,13 +157,20 @@ mesh = SubResource("PlaneMesh_kyck2")
|
||||||
skeleton = NodePath("../..")
|
skeleton = NodePath("../..")
|
||||||
surface_material_override/0 = SubResource("ShaderMaterial_avbpb")
|
surface_material_override/0 = SubResource("ShaderMaterial_avbpb")
|
||||||
|
|
||||||
[node name="PlayerHand" type="Node3D" parent="." node_paths=PackedStringArray("blocks_node", "gizmo_node")]
|
[node name="PlayerHand" type="Node3D" parent="." node_paths=PackedStringArray("blocks_node", "gizmo_node", "shape_cast", "camera_pivot")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.28028, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.28028, 0)
|
||||||
script = ExtResource("4_kq4yo")
|
script = ExtResource("4_kq4yo")
|
||||||
moveScale = 0.5
|
moveScale = 0.5
|
||||||
block_scene = ExtResource("5_mn8hr")
|
block_scene = ExtResource("5_mn8hr")
|
||||||
blocks_node = NodePath("../Blocks")
|
blocks_node = NodePath("../Blocks")
|
||||||
gizmo_node = NodePath("../UserInterface/SubViewportContainer/SubViewport/TransformGizmo")
|
gizmo_node = NodePath("../UserInterface/SubViewportContainer/SubViewport/TransformGizmo")
|
||||||
|
shape_cast = NodePath("ShapeCast3D")
|
||||||
|
camera_pivot = NodePath("../CameraPivot")
|
||||||
|
|
||||||
|
[node name="ShapeCast3D" type="ShapeCast3D" parent="PlayerHand"]
|
||||||
|
shape = SubResource("BoxShape3D_dk6bf")
|
||||||
|
target_position = Vector3(0, 0, 0)
|
||||||
|
debug_shape_custom_color = Color(1, 0, 0, 1)
|
||||||
|
|
||||||
[node name="Blocks" type="Node3D" parent="."]
|
[node name="Blocks" type="Node3D" parent="."]
|
||||||
|
|
||||||
|
|
@ -355,6 +365,7 @@ label_settings = SubResource("LabelSettings_4ta2f")
|
||||||
horizontal_alignment = 1
|
horizontal_alignment = 1
|
||||||
vertical_alignment = 1
|
vertical_alignment = 1
|
||||||
|
|
||||||
|
[connection signal="new_player_up" from="." to="PlayerHand" method="_on_jenga_new_player_up"]
|
||||||
[connection signal="panic_drop" from="." to="PlayerHand" method="_on_jenga_panic_drop"]
|
[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="." method="_on_twitch_link_drop_block"]
|
||||||
[connection signal="dropBlock" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_drop_block"]
|
[connection signal="dropBlock" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_drop_block"]
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ extends Node3D
|
||||||
#region Variables
|
#region Variables
|
||||||
#Signals
|
#Signals
|
||||||
signal panic_drop()
|
signal panic_drop()
|
||||||
|
signal new_player_up()
|
||||||
#Enums
|
#Enums
|
||||||
|
|
||||||
#Constants
|
#Constants
|
||||||
|
|
@ -51,6 +51,7 @@ func _process(delta):
|
||||||
current_player = player_queue[0]
|
current_player = player_queue[0]
|
||||||
player_queue.erase(current_player)
|
player_queue.erase(current_player)
|
||||||
turn_started = false
|
turn_started = false
|
||||||
|
new_player_up.emit()
|
||||||
turn_timer = accept_time_limit
|
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())
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ extends Node3D
|
||||||
@export_group("Node References")
|
@export_group("Node References")
|
||||||
@export var gizmo_pivot : Node3D
|
@export var gizmo_pivot : Node3D
|
||||||
|
|
||||||
|
|
||||||
#Onready Variables
|
#Onready Variables
|
||||||
|
|
||||||
#Other Variables (please try to separate and organise!)
|
#Other Variables (please try to separate and organise!)
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ extends Node3D
|
||||||
@export_group("Node References")
|
@export_group("Node References")
|
||||||
@export var blocks_node : Node3D
|
@export var blocks_node : Node3D
|
||||||
@export var gizmo_node : Node3D
|
@export var gizmo_node : Node3D
|
||||||
|
@export var shape_cast : ShapeCast3D
|
||||||
|
@export var camera_pivot : Node3D
|
||||||
|
|
||||||
#Onready Variables
|
#Onready Variables
|
||||||
|
|
||||||
|
|
@ -42,6 +44,8 @@ func _process(delta):
|
||||||
rotation_degrees = lerp(rotation_degrees, tar_rotation, 0.1)
|
rotation_degrees = lerp(rotation_degrees, tar_rotation, 0.1)
|
||||||
position = lerp(position, tar_position, 0.1)
|
position = lerp(position, tar_position, 0.1)
|
||||||
gizmo_node.rotation_degrees = rotation_degrees
|
gizmo_node.rotation_degrees = rotation_degrees
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -76,11 +80,20 @@ func _on_twitch_link_drop_block():
|
||||||
current_block.reparent(blocks_node)
|
current_block.reparent(blocks_node)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func _on_twitch_link_start_turn():
|
func _on_twitch_link_start_turn():
|
||||||
position = Vector3(0,2.28,0)
|
#var spawn_pos : Vector3 = Vector3(0,3,0)
|
||||||
|
|
||||||
|
position.x = 0
|
||||||
|
position.y = 0
|
||||||
rotation_degrees = Vector3(0,0,0)
|
rotation_degrees = Vector3(0,0,0)
|
||||||
|
tar_position.x = 0
|
||||||
|
tar_rotation.y = 0
|
||||||
|
tar_rotation = Vector3(0,0,0)
|
||||||
current_block = block_scene.instantiate()
|
current_block = block_scene.instantiate()
|
||||||
current_block.freeze = true
|
current_block.freeze = true
|
||||||
|
|
||||||
add_child(current_block)
|
add_child(current_block)
|
||||||
|
|
||||||
func _on_jenga_panic_drop():
|
func _on_jenga_panic_drop():
|
||||||
|
|
@ -101,3 +114,11 @@ func _on_jenga_panic_drop():
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _on_jenga_new_player_up():
|
||||||
|
if(shape_cast.get_collision_count()>0):
|
||||||
|
position.y += 1
|
||||||
|
tar_position.y += 1
|
||||||
|
camera_pivot.target_height += position.y + 1.5
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue