good progress very much playable

This commit is contained in:
Clevertop 2024-05-18 17:10:05 +10:00
parent 5381d72a5c
commit 24a59ad4ac
5 changed files with 69 additions and 35 deletions

View file

@ -1,11 +1,11 @@
[gd_scene load_steps=22 format=3 uid="uid://bdtfounpnyaoo"]
[gd_scene load_steps=21 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"]
[ext_resource type="Shader" path="res://addons/water_shader/shaders/water.gdshader" id="2_rliwp"]
[ext_resource type="Material" uid="uid://bwrsgjub33pd4" path="res://materials/BaseMaterial.tres" id="2_txp0l"]
[ext_resource type="Material" uid="uid://bfl54pvxyctrd" path="res://materials/BlockMaterial.tres" id="2_wr2cl"]
[ext_resource type="Script" path="res://scripts/PlayerHand.gd" id="4_kq4yo"]
[ext_resource type="PackedScene" uid="uid://b2fnlbcm3p6f" path="res://prefabs/block.tscn" id="5_mn8hr"]
[sub_resource type="Environment" id="Environment_h6sx5"]
ambient_light_color = Color(1, 1, 1, 1)
@ -82,9 +82,6 @@ shader_parameter/wave_b = SubResource("NoiseTexture2D_2unhc")
shader_parameter/surface_normals_a = SubResource("NoiseTexture2D_ptjyb")
shader_parameter/surface_normals_b = SubResource("NoiseTexture2D_r4a3k")
[sub_resource type="BoxShape3D" id="BoxShape3D_y33cj"]
size = Vector3(1, 0.59, 3)
[sub_resource type="BoxShape3D" id="BoxShape3D_gmpx6"]
size = Vector3(1, 10, 3)
@ -123,39 +120,32 @@ mesh = SubResource("PlaneMesh_kyck2")
skeleton = NodePath("../..")
surface_material_override/0 = SubResource("ShaderMaterial_avbpb")
[node name="PlayerHand" type="Node3D" parent="."]
[node name="PlayerHand" type="Node3D" parent="." node_paths=PackedStringArray("blocks_node")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.28028, 0)
script = ExtResource("4_kq4yo")
moveScale = 0.5
block_scene = ExtResource("5_mn8hr")
blocks_node = NodePath("../Blocks")
[node name="RigidBody3D" type="RigidBody3D" parent="PlayerHand"]
freeze = true
[node name="Blocks" type="Node3D" parent="."]
[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerHand/RigidBody3D"]
shape = SubResource("BoxShape3D_y33cj")
[node name="CSGBox3D" type="CSGBox3D" parent="PlayerHand/RigidBody3D"]
size = Vector3(1, 0.59, 3)
material = ExtResource("2_wr2cl")
[node name="StartingPlatform" type="Node3D" parent="."]
[node name="StaticBody3D" type="StaticBody3D" parent="StartingPlatform"]
[node name="StaticBody3D" type="StaticBody3D" parent="Blocks"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -4.25525, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="StartingPlatform/StaticBody3D"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Blocks/StaticBody3D"]
shape = SubResource("BoxShape3D_gmpx6")
[node name="BasePlatform" type="CSGBox3D" parent="StartingPlatform/StaticBody3D"]
[node name="BasePlatform" type="CSGBox3D" parent="Blocks/StaticBody3D"]
material_override = ExtResource("2_txp0l")
size = Vector3(1, 10, 3)
[node name="StaticBody3D3" type="StaticBody3D" parent="StartingPlatform"]
[node name="StaticBody3D3" type="StaticBody3D" parent="Blocks"]
transform = Transform3D(-1, 0, 8.74228e-08, 0, 1, 0, -8.74228e-08, 0, -1, 2, -4.25525, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="StartingPlatform/StaticBody3D3"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="Blocks/StaticBody3D3"]
shape = SubResource("BoxShape3D_gmpx6")
[node name="BasePlatform" type="CSGBox3D" parent="StartingPlatform/StaticBody3D3"]
[node name="BasePlatform" type="CSGBox3D" parent="Blocks/StaticBody3D3"]
material_override = ExtResource("2_txp0l")
size = Vector3(1, 10, 3)
@ -175,4 +165,6 @@ offset_bottom = 23.0
text = "meow"
label_settings = SubResource("LabelSettings_y2xp5")
[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"]
[connection signal="startTurn" from="TwitchLink" to="PlayerHand" method="_on_twitch_link_start_turn"]

16
prefabs/block.tscn Normal file
View file

@ -0,0 +1,16 @@
[gd_scene load_steps=3 format=3 uid="uid://b2fnlbcm3p6f"]
[ext_resource type="Material" uid="uid://bfl54pvxyctrd" path="res://materials/BlockMaterial.tres" id="1_3ye0r"]
[sub_resource type="BoxShape3D" id="BoxShape3D_y33cj"]
size = Vector3(1, 0.59, 3)
[node name="RigidBody3D" type="RigidBody3D"]
freeze = true
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("BoxShape3D_y33cj")
[node name="CSGBox3D" type="CSGBox3D" parent="."]
size = Vector3(1, 0.59, 3)
material = ExtResource("1_3ye0r")

View file

@ -54,3 +54,5 @@ func _process(delta):
#region Other methods (please try to separate and organise!)
#endregion

View file

@ -12,10 +12,17 @@ extends Node3D
#Exported Variables
#@export_group("Group")
#@export_subgroup("Subgroup")
@export_group("Config")
@export var moveScale : float = 1
@export_group("Prefabs")
@export var block_scene : PackedScene
@export_group("Node References")
@export var blocks_node : Node3D
#Onready Variables
#Other Variables (please try to separate and organise!)
var current_block : RigidBody3D
#endregion
@ -30,14 +37,6 @@ func _process(delta):
#endregion
#region Signal methods
#endregion
#region Other methods (please try to separate and organise!)
#endregion
func _on_twitch_link_move_block(direction, amount):
var dir : Vector3
match direction:
@ -47,4 +46,27 @@ func _on_twitch_link_move_block(direction, amount):
"east" : dir = Vector3.RIGHT
"south" : dir = Vector3.BACK
"west" : dir = Vector3.LEFT
position += dir * amount
position += dir * amount * moveScale
func _on_twitch_link_drop_block():
current_block.freeze = false
current_block.reparent(blocks_node)
func _on_twitch_link_start_turn():
position = Vector3(0,3,0)
current_block = block_scene.instantiate()
current_block.freeze = true
add_child(current_block)
#endregion
#region Other methods (please try to separate and organise!)
#endregion

View file

@ -2,6 +2,7 @@ extends Gift
signal moveBlock(direction : String, amount : float)
signal dropBlock()
signal startTurn()
@export_group("Node References")
@export var jenga_manager : Node
@ -120,7 +121,7 @@ func join_queue(cmd_info : CommandInfo):
if (searchResult == -1):
#not found in queue, they get added
jenga_manager.player_queue.append(player_name)
chat(searchResult + "joined the queue")
chat(str(player_name) + " joined the queue")
else:
chat("Sorry " + player_name + " you already in the queue at position: " + searchResult)
@ -129,7 +130,7 @@ func leave_queue(cmd_info : CommandInfo):
var player_name = cmd_info.sender_data.tags["display-name"]
var searchResult = jenga_manager.player_queue.find(player_name)
if (searchResult == -1):
chat(searchResult + "! you are not currently in the queue, join with !join_queue")
chat(str(player_name) + "! you are not currently in the queue, join with !join_queue")
else:
jenga_manager.player_queue.erase(player_name)
chat(searchResult + " left the queue")
@ -139,6 +140,7 @@ func leave_queue(cmd_info : CommandInfo):
func start_turn(cmd_info : CommandInfo):
#give the player who turn is about to start 20(?) seconds to confirm their turn
if(cmd_info.sender_data.tags["display-name"] == jenga_manager.current_player and not jenga_manager.turn_started):
startTurn.emit()
jenga_manager.turn_started=true
jenga_manager.turn_timer = jenga_manager.turn_time_limit
pass