From e9a896a91241119c1384c4ab70ac98f353f34769 Mon Sep 17 00:00:00 2001 From: Clevertop Date: Mon, 12 Aug 2024 00:10:55 +1000 Subject: [PATCH] messing around with path3d stuff --- Commands/command_block.gd | 26 ++++++++++++-------------- Commands/command_block.tscn | 14 +++++++++++--- Levels/StartingRoom.tscn | 16 ++++++++-------- README.md | 1 + 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/Commands/command_block.gd b/Commands/command_block.gd index cbf9b25..3e926ef 100644 --- a/Commands/command_block.gd +++ b/Commands/command_block.gd @@ -1,21 +1,22 @@ -#@tool +@tool extends RigidBody3D class_name Command_Block +#TODO make this all an enum @export var command_name : String -@export var command_sprite : Texture2D#: +@export var mesh : MeshInstance3D +@export var command_sprite : Texture2D: + set(new_texture): + command_sprite = new_texture + mesh.material_override = mesh.material_override.duplicate() + mesh.material_override.albedo_texture = command_sprite + @export var collider : CollisionShape3D var spawn_pos : Vector3 - #set(new_texture): - #if command_sprite != null: - #command_sprite.changed.disconnect(on_texture_changed) - #command_sprite = new_texture - #command_sprite.changed.connect(on_texture_changed) - # Called when the node enters the scene tree for the first time. func _ready(): - $MeshInstance3D.material_override = $MeshInstance3D.material_override.duplicate() - $MeshInstance3D.material_override.albedo_texture = command_sprite + mesh.material_override = mesh.material_override.duplicate() + mesh.material_override.albedo_texture = command_sprite spawn_pos = global_position pass # Replace with function body. @@ -27,7 +28,4 @@ func _process(delta): linear_velocity = Vector3(0,0,0) pass -#func on_texture_changed(): - #print("meow") - #$MeshInstance3D.material_override = $MeshInstance3D.material_override.duplicate() - #$MeshInstance3D.material_override.albedo_texture = command_sprite + diff --git a/Commands/command_block.tscn b/Commands/command_block.tscn index d43ad40..2e4cc57 100644 --- a/Commands/command_block.tscn +++ b/Commands/command_block.tscn @@ -1,21 +1,29 @@ [gd_scene load_steps=6 format=3 uid="uid://dqvq4ybcpws87"] -[ext_resource type="Material" uid="uid://2i80f5wutvco" path="res://Assets/Materials/baseCommand.tres" id="1_ksvsv"] [ext_resource type="Script" path="res://Commands/command_block.gd" id="1_ra6j6"] [ext_resource type="Script" path="res://Commands/tool.gd" id="3_lrl7m"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cywoj"] +emission = Color(1, 1, 1, 1) +subsurf_scatter_strength = 1.0 +uv1_scale = Vector3(3, 2, 1) +uv1_triplanar_sharpness = 0.0583145 +uv2_triplanar_sharpness = 0.170755 +texture_filter = 0 + [sub_resource type="BoxMesh" id="BoxMesh_572kf"] size = Vector3(0.5, 0.5, 0.5) [sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_mmdx7"] points = PackedVector3Array(0.25, 0.25, 0.25, 0.25, 0.25, -0.25, -0.25, 0.25, 0.25, 0.25, -0.25, 0.25, 0.25, -0.25, -0.25, -0.25, 0.25, -0.25, -0.25, -0.25, 0.25, -0.25, -0.25, -0.25) -[node name="BaseCommand" type="RigidBody3D" node_paths=PackedStringArray("collider")] +[node name="BaseCommand" type="RigidBody3D" node_paths=PackedStringArray("mesh", "collider")] script = ExtResource("1_ra6j6") +mesh = NodePath("MeshInstance3D") collider = NodePath("CollisionShape3D3") [node name="MeshInstance3D" type="MeshInstance3D" parent="."] -material_override = ExtResource("1_ksvsv") +material_override = SubResource("StandardMaterial3D_cywoj") mesh = SubResource("BoxMesh_572kf") script = ExtResource("3_lrl7m") diff --git a/Levels/StartingRoom.tscn b/Levels/StartingRoom.tscn index 72d2d49..1610c72 100644 --- a/Levels/StartingRoom.tscn +++ b/Levels/StartingRoom.tscn @@ -9,9 +9,9 @@ [ext_resource type="PackedScene" uid="uid://dqvq4ybcpws87" path="res://Commands/command_block.tscn" id="5_81jk1"] [ext_resource type="Texture2D" uid="uid://bb8771vptn2l8" path="res://Assets/Textures/transparent_wall_new.png" id="6_nv7xj"] [ext_resource type="Texture2D" uid="uid://dd150xco2ee5q" path="res://Assets/Textures/cobalt_stone_4.png" id="7_qjeey"] +[ext_resource type="Texture2D" uid="uid://vc7wwv4wgabf" path="res://Commands/jump.png" id="10_pecm3"] [ext_resource type="PackedScene" uid="uid://cq4rfdsc5kghr" path="res://Commands/command_pedestal.tscn" id="10_sghta"] -[ext_resource type="Texture2D" uid="uid://vc7wwv4wgabf" path="res://Commands/jump.png" id="10_x6wpo"] -[ext_resource type="Texture2D" uid="uid://cxljjpwweuds0" path="res://Commands/phase_shift_new.png" id="11_olm6e"] +[ext_resource type="Texture2D" uid="uid://cxljjpwweuds0" path="res://Commands/phase_shift_new.png" id="11_82hoi"] [ext_resource type="Texture2D" uid="uid://dx8s88cut5kka" path="res://Commands/haste_new.png" id="12_3c4u7"] [ext_resource type="AudioStream" uid="uid://jm6vo1vxrlyx" path="res://Assets/62986__radian__chime-0011.wav" id="12_bm4h4"] [ext_resource type="Texture2D" uid="uid://dc23iehev1s8w" path="res://Assets/Textures/crystal_wall_2.png" id="15_t0vv6"] @@ -178,32 +178,32 @@ shape = SubResource("BoxShape3D_y4l56") [node name="JumpCommand2" parent="." instance=ExtResource("5_81jk1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5, 1.322, -1.5) command_name = "jump" -command_sprite = ExtResource("10_x6wpo") +command_sprite = ExtResource("10_pecm3") [node name="JumpCommand3" parent="." instance=ExtResource("5_81jk1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.5, 1.322, -1.5) command_name = "jump" -command_sprite = ExtResource("10_x6wpo") +command_sprite = ExtResource("10_pecm3") [node name="JumpCommand4" parent="." instance=ExtResource("5_81jk1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.5, 1.322, -1.5) command_name = "jump" -command_sprite = ExtResource("10_x6wpo") +command_sprite = ExtResource("10_pecm3") [node name="PhaseCommand" parent="." instance=ExtResource("5_81jk1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.5, 1.322, -2.5) command_name = "phase" -command_sprite = ExtResource("11_olm6e") +command_sprite = ExtResource("11_82hoi") [node name="PhaseCommand2" parent="." instance=ExtResource("5_81jk1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.5, 1.322, -2.5) command_name = "phase" -command_sprite = ExtResource("11_olm6e") +command_sprite = ExtResource("11_82hoi") [node name="PhaseCommand3" parent="." instance=ExtResource("5_81jk1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.5, 1.322, -2.5) command_name = "phase" -command_sprite = ExtResource("11_olm6e") +command_sprite = ExtResource("11_82hoi") [node name="DashCommand" parent="." instance=ExtResource("5_81jk1")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.5, 1.322, -3.5) diff --git a/README.md b/README.md index 8adb44f..fd56c30 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ Puzzle game made by Tom for the Playmakers August Jam 2024 - [x] tick chime - [ ] take/place/drop block - [ ] per command sounds? +- [ ] enum dropdown for the command blocks ## COMMANDS