From 9549acde6e9d1416303ed0e7dcc09a24f32cdc9a Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Wed, 26 Feb 2025 01:28:23 -0500 Subject: [PATCH 1/3] Revert "scale up canny" This reverts commit 53d564b4a4a836dc899eb16575008570bf78828d. --- objects/canny_cat.tscn | 8 ++++---- objects/goal_post.tscn | 17 ++++++++--------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/objects/canny_cat.tscn b/objects/canny_cat.tscn index 08e22ba..d795bf4 100644 --- a/objects/canny_cat.tscn +++ b/objects/canny_cat.tscn @@ -24,7 +24,7 @@ shading_mode = 0 albedo_color = Color(0.916968, 0.113727, 0, 1) [sub_resource type="SphereShape3D" id="SphereShape3D_4o01j"] -radius = 0.9 +radius = 0.45 [sub_resource type="AudioStreamInteractive" id="AudioStreamInteractive_plnjn"] clip_count = 3 @@ -39,7 +39,7 @@ clip_2/auto_advance = 0 [sub_resource type="CylinderMesh" id="CylinderMesh_b16dl"] top_radius = 0.05 bottom_radius = 0.05 -height = 8.0 +height = 4.0 radial_segments = 4 rings = 0 @@ -87,7 +87,7 @@ shape = SubResource("SphereShape3D_4o01j") [node name="Graphics" type="Node3D" parent="."] [node name="CannySprite" type="Sprite3D" parent="Graphics"] -pixel_size = 0.0313 +pixel_size = 0.0156 billboard = 1 texture_filter = 0 texture = ExtResource("1_cp4br") @@ -127,7 +127,7 @@ bus = &"Sounds" visible = false [node name="PowerLine" type="MeshInstance3D" parent="PowerIndicator"] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 4) +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 2) material_override = SubResource("StandardMaterial3D_2xpb7") cast_shadow = 0 gi_mode = 0 diff --git a/objects/goal_post.tscn b/objects/goal_post.tscn index 3f4a32d..880dbcf 100644 --- a/objects/goal_post.tscn +++ b/objects/goal_post.tscn @@ -11,9 +11,9 @@ metallic_specular = 0.0 [sub_resource type="CylinderMesh" id="CylinderMesh_i27ie"] material = SubResource("StandardMaterial3D_e2vbu") -top_radius = 0.2 -bottom_radius = 0.2 -height = 6.0 +top_radius = 0.1 +bottom_radius = 0.1 +height = 4.0 radial_segments = 6 rings = 8 @@ -30,13 +30,12 @@ shader_parameter/wave_scale = 0.25 [sub_resource type="QuadMesh" id="QuadMesh_mfpmh"] material = SubResource("ShaderMaterial_3urv4") -size = Vector2(3, 1.5) +size = Vector2(2, 1) subdivide_width = 6 -center_offset = Vector3(1.5, -0.75, 0) +center_offset = Vector3(1, 0, 0) [sub_resource type="CylinderShape3D" id="CylinderShape3D_eshe3"] height = 0.5 -radius = 1.0 [node name="GoalPost" type="Node3D"] script = ExtResource("1_08x2x") @@ -44,16 +43,16 @@ script = ExtResource("1_08x2x") [node name="Graphics" type="Node3D" parent="."] [node name="Pole" type="MeshInstance3D" parent="Graphics"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0) mesh = SubResource("CylinderMesh_i27ie") [node name="Flag" type="MeshInstance3D" parent="Graphics"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 6, 0) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.5, 0) mesh = SubResource("QuadMesh_mfpmh") [node name="Sprite3D" type="Sprite3D" parent="Graphics"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.01, 0) -pixel_size = 0.0625 +pixel_size = 0.0313 axis = 1 alpha_cut = 2 texture_filter = 0 From aa6b9cb4aa05be5180f8cb0aa481ead457edc363 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Wed, 26 Feb 2025 04:01:29 -0500 Subject: [PATCH 2/3] waterpole improvements --- assets/shaders/barber_shop.gdshader | 19 +++++++++++++++++++ objects/canny_cat.gd | 4 +++- objects/canny_cat.tscn | 3 ++- objects/waterman_pole.gd | 1 - objects/waterman_pole.tscn | 25 ++++++++++++++++--------- test_scene.tscn | 4 ---- 6 files changed, 40 insertions(+), 16 deletions(-) create mode 100644 assets/shaders/barber_shop.gdshader diff --git a/assets/shaders/barber_shop.gdshader b/assets/shaders/barber_shop.gdshader new file mode 100644 index 0000000..ad3dbaf --- /dev/null +++ b/assets/shaders/barber_shop.gdshader @@ -0,0 +1,19 @@ +shader_type spatial; +render_mode specular_disabled, vertex_lighting; + +uniform vec3 color_a : source_color = vec3(1.0); +uniform vec3 color_b : source_color = vec3(0.0); +uniform float stripe_count = 2.0; +uniform float twist_factor = 1.0; +uniform float speed = 0.5; + +void vertex() { + float world_height = (MODEL_MATRIX * vec4(VERTEX, 1.0)).y; + UV.y = world_height - TIME * speed; +} + +void fragment() { + float twisted_x = UV.x - (UV.y * twist_factor); + float stripe = step(sin(twisted_x * stripe_count * TAU), 0.0); + ALBEDO = mix(color_a, color_b, stripe); +} \ No newline at end of file diff --git a/objects/canny_cat.gd b/objects/canny_cat.gd index 591f790..ee9c3d5 100644 --- a/objects/canny_cat.gd +++ b/objects/canny_cat.gd @@ -163,8 +163,10 @@ func _start_winning() -> void: #region Pole Spinning var _attached_pole: WatermanPole = null var _pole_angle: float = 0.0 +var _pole_stored_speed: float = 0.0 func _start_pole_spin() -> void: + _pole_stored_speed = flatten_vector(velocity).length() velocity = Vector3.ZERO var pole_xz = flatten_vector(_attached_pole.global_position) var self_xz = flatten_vector(global_position) @@ -189,7 +191,7 @@ func _process_pole_spin(delta: float) -> void: func _end_pole_spin() -> void: var pole_xz = flatten_vector(_attached_pole.global_position) - var impulse = Vector3.FORWARD.rotated(Vector3.UP, _pole_angle) * _attached_pole.release_boost + var impulse = Vector3.FORWARD.rotated(Vector3.UP, _pole_angle) * _pole_stored_speed velocity.x = impulse.x velocity.z = impulse.z #endregion diff --git a/objects/canny_cat.tscn b/objects/canny_cat.tscn index d795bf4..b843a88 100644 --- a/objects/canny_cat.tscn +++ b/objects/canny_cat.tscn @@ -135,6 +135,7 @@ mesh = SubResource("CylinderMesh_b16dl") [node name="CameraArm" type="SpringArm3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 0, 0) +collision_mask = 8 spring_length = 8.0 [node name="Camera3D" type="Camera3D" parent="CameraArm"] @@ -212,8 +213,8 @@ delay_in_seconds = "0.0" [connection signal="charge_canceled" from="." to="Sounds/ChargeCancel" method="play"] [connection signal="shot" from="." to="Sounds/Shoot" method="play"] [connection signal="state_physics_processing" from="StateChart/Root/Idle" to="." method="_apply_gravity"] -[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_bounce_on_walls"] [connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_apply_gravity"] +[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_bounce_on_walls"] [connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_slow_to_stop"] [connection signal="state_entered" from="StateChart/Root/Charging" to="." method="_start_charge"] [connection signal="state_entered" from="StateChart/Root/Charging" to="Sounds/ChargeStart" method="play"] diff --git a/objects/waterman_pole.gd b/objects/waterman_pole.gd index 58974b2..f7c4c3d 100644 --- a/objects/waterman_pole.gd +++ b/objects/waterman_pole.gd @@ -6,7 +6,6 @@ extends Node3D @export_range(-1,1,0.5,"or_less","or_greater","radians_as_degrees") var spin_speed: float @export var offset: float -@export var release_boost: float @export_group("Node References") @export var top: Node3D diff --git a/objects/waterman_pole.tscn b/objects/waterman_pole.tscn index 7a5b0aa..8eb7da2 100644 --- a/objects/waterman_pole.tscn +++ b/objects/waterman_pole.tscn @@ -1,12 +1,16 @@ -[gd_scene load_steps=6 format=3 uid="uid://13qlrib2dk36"] +[gd_scene load_steps=7 format=3 uid="uid://13qlrib2dk36"] [ext_resource type="Script" path="res://objects/waterman_pole.gd" id="1_8whes"] +[ext_resource type="Shader" path="res://assets/shaders/barber_shop.gdshader" id="2_dukp0"] -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6xwjl"] -shading_mode = 2 -specular_mode = 2 -albedo_color = Color(3.27289e-06, 0.685269, 0.929658, 1) -metallic_specular = 0.0 +[sub_resource type="ShaderMaterial" id="ShaderMaterial_2dh7w"] +render_priority = 0 +shader = ExtResource("2_dukp0") +shader_parameter/color_a = Color(0.792663, 0.606026, 0.896219, 1) +shader_parameter/color_b = Color(0.106954, 0.441954, 1, 1) +shader_parameter/stripe_count = 2.0 +shader_parameter/twist_factor = 0.75 +shader_parameter/speed = 0.5 [sub_resource type="CylinderMesh" id="CylinderMesh_nbwjg"] top_radius = 0.25 @@ -17,7 +21,7 @@ rings = 8 [sub_resource type="CylinderShape3D" id="CylinderShape3D_28fhu"] height = 1.0 -radius = 0.25 +radius = 0.125 [sub_resource type="CylinderShape3D" id="CylinderShape3D_o6xmv"] height = 1.0 @@ -25,11 +29,14 @@ radius = 0.4 [node name="WatermanPole" type="Node3D" node_paths=PackedStringArray("top")] script = ExtResource("1_8whes") +rise_speed = 6.0 +spin_speed = 9.42478 +offset = 0.75 top = NodePath("Top") -[node name="MeshInstance3D" type="MeshInstance3D" parent="."] +[node name="PoleMesh" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) -material_override = SubResource("StandardMaterial3D_6xwjl") +material_override = SubResource("ShaderMaterial_2dh7w") mesh = SubResource("CylinderMesh_nbwjg") [node name="StaticBody3D" type="StaticBody3D" parent="."] diff --git a/test_scene.tscn b/test_scene.tscn index 5ee19a4..035f123 100644 --- a/test_scene.tscn +++ b/test_scene.tscn @@ -76,7 +76,3 @@ transform = Transform3D(0.707107, 0, -0.707107, 0, 1, 0, 0.707107, 0, 0.707107, [node name="WatermanPole" parent="." instance=ExtResource("7_m8si3")] transform = Transform3D(1, 0, 0, 0, 16, 0, 0, 0, 1, 0, 0, 0) -rise_speed = 8.0 -spin_speed = 12.5664 -offset = 1.0 -release_boost = 20.0 From cc177f7bebc8e330d08c39c0ccbae3217dadd7a2 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Thu, 27 Feb 2025 02:12:49 -0500 Subject: [PATCH 3/3] scene manager system --- assets/mesh_libraries/w1/w1_walls.meshlib | Bin 5968 -> 5967 bytes .../models/tiles/w1_walls/grey_block.material | Bin 370 -> 384 bytes autoloads/scene_manager.gd | 30 ++++++++++++++ autoloads/scene_manager.tscn | 37 ++++++++++++++++++ objects/canny_cat.tscn | 2 +- project.godot | 8 +++- 6 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 autoloads/scene_manager.gd create mode 100644 autoloads/scene_manager.tscn diff --git a/assets/mesh_libraries/w1/w1_walls.meshlib b/assets/mesh_libraries/w1/w1_walls.meshlib index 96a852f430095b948bb0756b8095e190bffe03b0..8f6b891d7837ae76380f4ebf447a50e2ec843f68 100644 GIT binary patch delta 608 zcmV-m0-ycRF3&CzQd2`i0ssI201yBGHIo1UNs$pQfBhi<*6NK%5U(a304iAkP@y6q zRROy~K5PU4pn@QvdU-TU2-(|*Y_hX|lb~#bjR$}(`q^Ip>^0DS;|0NRxm%ZbI?AGNrfHyeG!T_b2sa>E!VWvn)1FKd&n|3QvBlQh@E z8^@j8e{eK$O|h7{xy81bICiq;O`G(8$h%6eg)G@vZZiAcmXmYNz6i(j(_YcVD7eX%ST5@`W; zfeL}*LsdCtmSQp0SFVM`uo0Y;a41Wj_)%o_<-^{bl+hwHu1HrSb*V3T;0%9DSRAtf?5G#)I ze?aigD0s_c$r*+dM`7THaaK!FJA>+vvk?r)m^j6@6K0|Gx}m67p~X{RzFh3+c-8`IPI3sXMkSG!6# zycF`1$3N#d$U83bl7n32BL{HNH9m6DK}pZJ=b@AC>CoB3=FQo|DRP ut->%=by7-5@qY+Rs&CAJ&`1Bg^O5JGgYM}Z^w2?}i$1z&bWgK=0@DI!Qd2`i0ssI201yBGHIo1UN|6yRe+41{)+&xi5U(a304iAkP@y6q zRROy~K5PU4pn@QvdU2>`iNblb~#bjR$}(`q^Ip>ohrBsiJKnW39BqzNW|qdzu4i%I|0e$jTpS9h zcmX4YgQu>%*p%6DU--}QU-bX;AM^(j6lee~%!x?EHI|wh5Q|^425T`T?|rc>7ZPa! zb^(S!@qtr0WtL(w)mO7HrSgl{XW^zZTbNone>cX`vRoLP%6U6WjsKnNx~}WGuCFJm zZ|8A*J0}|G+Gd7cXaC&unP94u zO7=}ND2zI`WYShe=o43nI`3Hh$$z4l>@(YM@Y*Lj;S3s;d zf9QSRooV@OsU3*n#6j#sVby9WYG=SkRU5&8jEPfhJ7E?|=Qfaf6+c-8`IPI3sXMkSG!60l49{-%S|LLdF}&PSe$4!Wmv&_f4>F8b)A(LDjPd;-%HlE5b% diff --git a/assets/models/tiles/w1_walls/grey_block.material b/assets/models/tiles/w1_walls/grey_block.material index cd8e04b31bb37cd66de69f4a6ee9d1e34fa0eda3..2585b56fab5c1e4f39ff51769eb2faa088c4bf44 100644 GIT binary patch literal 384 zcmV-`0e}8dQ$s@n000005C8y?0ssJL0RR9fwJ-f(kpcAz0Jf1lGjMCt0sOBba7l!! zs@M$#z*WtxC7T>%6GB7Xnj}*4Pvkq$ZMZywRdi3IE{u-H{c5XID*!A2E&!KKjqc&* z3_iiM2mzvJT|^rvA(QerP8DMpYWgZfAT-z4;+V|3^(89Fe-MQ#`@Gs zP7E8~{|DZk7`~8R{|zpB6}yTtWTh^JtCbhRH4dk^Sd5(NSUwq2%MR47pLSl21Ux9);cR7P=X=G%sNv_4HnA#*w%dAi*SI~-T5~MBn@j2 zlc0dO4xm61=s@)nteCe@3+0Ed_@Y2rc!=nH4y+--i~|O5gtJg)+Tu10W2N`dIjA6w e(kOkF;;7JGC6qjJFA{)PHnL$5HvlYBQ$s`b1+$O< literal 370 zcmV-&0ge7rQ$s@n000005C8yU0ssJ70RR9fwJ-f(V*!N<0M-yXG+MKQN6{DR>Y&Gol$Qz-x`04xBEuhC`n z9BQ=HW8MGIe*=UF9`Sg5aNK2E?X*~Bxw-sT_)qYE@?YQ&E_-?zZQo|Cwo184p~Lxq z!I_i7_UQEg;Gb^$+ETd6riH7NQ^Ix9DE#n>%0+-P4TV!7bNf2HxRp8An&8U+fH&1P z(yiK~jgKkDWy4!JlX=LgFcg-H<-Y{_2Owx70U)t+*+B@`da+aXB#Hl$>wZeH5Xdv?l zR=``Zh4MvL@S@->JV10lC;Sj##-W41 void: + var tree = get_tree() + # capture main scene + if tree.current_scene != self: + change_scene(tree.current_scene) + tree.current_scene = self + + +func change_scene(new_scene: Node) -> void: + # avoid infinite recursion :P + if current_scene == new_scene: + return + # remove current scene + if current_scene: + scene_parent.remove_child(current_scene) + current_scene.queue_free() + # add new scene + if new_scene.is_inside_tree(): + new_scene.get_parent().remove_child.call_deferred(new_scene) + scene_parent.add_child.call_deferred(new_scene) + current_scene = new_scene diff --git a/autoloads/scene_manager.tscn b/autoloads/scene_manager.tscn new file mode 100644 index 0000000..fb7b332 --- /dev/null +++ b/autoloads/scene_manager.tscn @@ -0,0 +1,37 @@ +[gd_scene load_steps=2 format=3 uid="uid://dxrvocxjk8vs3"] + +[ext_resource type="Script" path="res://autoloads/scene_manager.gd" id="1_d112a"] + +[node name="SceneManager" type="Node" node_paths=PackedStringArray("scene_parent")] +script = ExtResource("1_d112a") +scene_parent = NodePath("HBoxContainer/MainView/SubViewportContainer/SubViewport") + +[node name="HBoxContainer" type="HBoxContainer" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="SideBar" type="Control" parent="HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 3 + +[node name="MainView" type="Control" parent="HBoxContainer"] +custom_minimum_size = Vector2(288, 216) +layout_mode = 2 +size_flags_horizontal = 10 + +[node name="SubViewportContainer" type="SubViewportContainer" parent="HBoxContainer/MainView"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="SubViewport" type="SubViewport" parent="HBoxContainer/MainView/SubViewportContainer"] +handle_input_locally = false +audio_listener_enable_3d = true +size = Vector2i(288, 216) +render_target_update_mode = 4 diff --git a/objects/canny_cat.tscn b/objects/canny_cat.tscn index b843a88..019bfee 100644 --- a/objects/canny_cat.tscn +++ b/objects/canny_cat.tscn @@ -213,9 +213,9 @@ delay_in_seconds = "0.0" [connection signal="charge_canceled" from="." to="Sounds/ChargeCancel" method="play"] [connection signal="shot" from="." to="Sounds/Shoot" method="play"] [connection signal="state_physics_processing" from="StateChart/Root/Idle" to="." method="_apply_gravity"] -[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_apply_gravity"] [connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_bounce_on_walls"] [connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_slow_to_stop"] +[connection signal="state_physics_processing" from="StateChart/Root/Moving" to="." method="_apply_gravity"] [connection signal="state_entered" from="StateChart/Root/Charging" to="." method="_start_charge"] [connection signal="state_entered" from="StateChart/Root/Charging" to="Sounds/ChargeStart" method="play"] [connection signal="state_exited" from="StateChart/Root/Charging" to="." method="_end_charge"] diff --git a/project.godot b/project.godot index c55e805..6fdb7e4 100644 --- a/project.godot +++ b/project.godot @@ -15,10 +15,14 @@ run/main_scene="res://test_scene.tscn" config/features=PackedStringArray("4.3", "GL Compatibility") config/icon="res://icon.svg" +[autoload] + +SceneManager="*res://autoloads/scene_manager.tscn" + [display] -window/size/viewport_width=320 -window/size/viewport_height=240 +window/size/viewport_width=384 +window/size/viewport_height=216 window/stretch/mode="viewport" [editor_plugins]