From 08712cf22c72182bdbcb30fdb47d1638b4c9a3b4 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Sat, 22 Feb 2025 19:55:12 -0500 Subject: [PATCH] goalpost --- assets/mesh_libraries/w1/w1_walls.meshlib | Bin 3739 -> 3738 bytes assets/shaders/flag.gdshader | 36 ++++++++++ assets/textures/objects/goal_hole.png | Bin 0 -> 833 bytes assets/textures/objects/goal_hole.png.import | 35 ++++++++++ assets/textures/shadow.png | Bin 3167 -> 6701 bytes objects/canny_cat.gd | 29 +++++++- objects/canny_cat.tscn | 50 +++++++------ objects/goal_post.gd | 7 ++ objects/goal_post.tscn | 70 +++++++++++++++++++ project.godot | 6 +- test_scene.tscn | 48 +++++++++---- 11 files changed, 244 insertions(+), 37 deletions(-) create mode 100644 assets/shaders/flag.gdshader create mode 100644 assets/textures/objects/goal_hole.png create mode 100644 assets/textures/objects/goal_hole.png.import create mode 100644 objects/goal_post.gd create mode 100644 objects/goal_post.tscn diff --git a/assets/mesh_libraries/w1/w1_walls.meshlib b/assets/mesh_libraries/w1/w1_walls.meshlib index 11ff93259a8cf41d32450df0ef62a10f3ebaf175..1231501ce22da98d7287fc55cea211152a54b9ad 100644 GIT binary patch delta 585 zcmV-P0=E5|9hw~xQd2`i0ssI201yBGu1Wv^Dv=Qye+3}`<|v3pAj>8lggXEMgbaX@ z5G~ozUI)Me07D=n!H=5~OZK)Wn{0a*`z0al_d$bLl#;@2FNF7glnye_qcB59@DXAQ zqpfX|mI7-4bpUn%@wSOt?9Ho*&f%^Rw43B`mPr|_&G^%Lv-N+*aceT>et6>8lN^p) z*EEZ{f16zFnTew(YvxFk{?~X{*;%~1)^M~rQmI)QTf3jdegA*_?=Y!QzypX79TNO> z<;|u84)=rq6#qm2J^w#{EFhqf)2$Dncp$vu()Y!aymtk|R48PC`GDbNV&%ARCMju_ zX7SXQgkef07)?M7H=P;76vMeOmKdgjaw_NTe=H^bcMkS6_4O`}Z=WOuA<)^GC25*u z=W$%GjlrF~IbtPP?L0}cPMPJ_GZXY~lCG>+&MYIKi|%>nqU)i5es%si=pWES7d<5U zb8lggXEMgbaX@ z5G~Q#UI)Me07D=n!H?-~jqGhtHre)W$d`n$-vMX6yfqc0>G84y7*4%NE{?~X{=~=wJ)^M~rQmI)QTf3meegA*_?=YcIzypX79T5C< z<;`Y;4!48<6#qg0JO4d@EFhne)2$DnbRN9o5eUYUymtk|R3>16`EcQ7V&%ARCK+j# zX7SXQ!!V_?6irGPZaOoDDTZ@nEHO+4Wx z_0F#jgUu72ys6Z1B!LM~Z~f06Xtjzk48vc+{{hj|`8KIZGtWBjCvpq}&$3<{6Y>kN zfADNll1XESyW}nsZt|5*Qes~)n>s=O4(Cj!Y@^G@BQktsy9%SY0OiGG1F9NTm`bHW zmWriPsaPvkO{!+YY6Fc1nw4s0V`CHE+}z+#)^FC76_yqVx#MPcd7Gt>>!V`4;}iG1 z;}sgOxOnFj&$z`m?(vLooZ|ovy2LpSE4t_rzy7)C7ffd`n>Xi+kC~a7zZJGZ)WcQ_ Y)e6H9#S!rk#s3;Cr@k!#vrz&`4BojIA^-pY diff --git a/assets/shaders/flag.gdshader b/assets/shaders/flag.gdshader new file mode 100644 index 0000000..cd18e0d --- /dev/null +++ b/assets/shaders/flag.gdshader @@ -0,0 +1,36 @@ +shader_type spatial; +render_mode vertex_lighting, specular_disabled, cull_disabled; + +uniform vec3 color_bright : source_color = vec3(1.0); +uniform vec3 color_dark : source_color = vec3(0.0); +uniform float pivot = 0.0; +uniform float pivot_speed = 1.0; +uniform float waves = 4.0; +uniform float wave_speed = 1.0; +uniform float wave_scale = 0.25; + +void vertex() { + float body = (VERTEX.x) / 2.0; + + VERTEX.z = sin(VERTEX.x * waves + TIME * wave_speed) * wave_scale * body; + + float pivot_angle = cos(TIME * pivot_speed) * 0.1 * pivot; + mat2 rotation_matrix = mat2( + vec2(cos(pivot_angle), -sin(pivot_angle)), + vec2(sin(pivot_angle), cos(pivot_angle)) + ); + VERTEX.xz = rotation_matrix * VERTEX.xz; + + float color_weight = sin(VERTEX.x * waves + TIME * wave_speed); + COLOR = vec4(mix(color_dark, color_bright, color_weight), 1.0); + //VERTEX.z += cos(time + body) * wave; +} + +void fragment() { + ALBEDO = COLOR.rgb; +} + +//void light() { + // Called for every pixel for every light affecting the material. + // Uncomment to replace the default light processing function with this one. +//} diff --git a/assets/textures/objects/goal_hole.png b/assets/textures/objects/goal_hole.png new file mode 100644 index 0000000000000000000000000000000000000000..2200068af141454c8ee313932b29b1c2eead618f GIT binary patch literal 833 zcmV-H1HSx;P)EX>4Tx04R}tkv&MmKp2MKrivo14i*t{$WWc^q9Ts93Pq?8YK2xEOfLO{CJjl7 zi=*ILaPVib>fqw6tAnc`2>yV$3r>nIQsQ?>p+$^$9QW|v_rBbH2MCP{)2yyIpy{@m zPA0@`ZdL4gg@7TN{Rqpf;?j{x8AVm!;g?#~fc^A-aFB5|Ax##3oQp0CJTqcu((}X-VzJo4N(Zx&sS!^TM^#Oyd?D+x z%6W^kR;jVpJ^2emd3|M>>$FCZ#3Gg;L4<-D%Ba9bjCP$A3u!t}`1nU$zeFyDTxBqF zET9Svvg-%`gWtWi3R9C_QYZm*zc|jv7|^o|H0zG@ee5{R6Cn5uT^ZM30$LRx*p=O)(u(G#^|$ zBX3A7a7itAPB4pGIhJESnq@$wZAGPRMXPa04IB@_00001bW%=J06^y0W&i*H0b)x> zL;#2d9Y_EG010qNS#tmY3ljhU3ljkVnw%H_000McNliru=>irP0u0c^Ae8_B02y>e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{007lVL_t(I%VS`Gf&XB@fCl*g z!vS#;|B=B5H1)5RhlW?ZLzTfL0TTbyVJHX$#y#hetN}7_P7;IwA550kiZwZIO7AS z1oo)KnM&|U;7D*d(=Kia-1!4%j>0K{JJ;gO=eQ+smnAq$A4~}VD_Dw752CV5@?PUU8|S zQWx5y6$NYUMa62}u*ITQy=rYQXj>`m#Ud*7QY-pcxpNXWTkpNKPy3IP=gZ9b=9_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4X@7nuN-Vgh@j{midV85JbK~rd(z;xcDT}b({^#b_lr^h1!EX}N{ zmdT#Ea(Pq*Vsj>o$T&%_n_&!)5~B^Vhxr0+?>!d*e3bTs?C-QfWGzCNQmg*8n8e-= zBsiLj6XhdJ4lwo8eru29uK7vN_Ce&;1Js{p{-@I$E#MkC3Ie`Z8BWNk9dpj;C& zg1iOrcK|;L@Lxm-*LPVYWlcf12|7N&-E2HG1s;^oyeUwTB!^tkUjLIBaaH?|*~^Zt z6TEh#s_So`nT1HDkxvR2G)8izgenuljevhA#CK*k+*be!dSyVaWu=9#%p9!GG4;Dp z8z>KEkOVf~<@sZ(fA&8cwO6;ddZ++a7_Pq7#fL=Qmmicce#s=#l$MNnP?_*P0Qjej z{)LP7Mn9t1b+vfA`kGqMA`nKmBJ-)yhEi3wBorP|c@O>;zcvc^8ER87v$*3YrEbR)P24ff6)a-OC#k!B;3@3>Om0y zbHD{z5`={G&Ly#VC(pYO^|!2lr{6<9n$k5z-=P2TlzuyOh;~`Z!7yOzRY@s{8T5B6 z1)3WHtcxA5T)Vsvh=+eRN0@`RpUUaSR8!O1&*mWivk9#g@MlxFP`9R=el}-6m9qt$ z2fY5{{pQpzbU->rw-n8;$Ju^1E2t0Mdqf{j+G6b``b%EFnhz&^k1cpMYjFrO`G0Dr zsiRrjg)7o}A$--J&SpGewO}e(XJ$eLt}eM10JW1gi~HL5*B}7@n@aFB void: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED @@ -57,6 +63,13 @@ func _unhandled_input(event: InputEvent) -> void: camera_arm.rotation.x = clampf(camera_arm.rotation.x, -camera_high_angle, -camera_low_angle) +#region Public Functions +func enter_goal(goal: GoalPost) -> void: + _entered_goal = goal + state_chart.send_event(&"goal_entered") +#endregion + + #region Charging func _start_charge() -> void: charging_power = true @@ -115,3 +128,17 @@ func _bounce_on_walls(delta: float = 0.0) -> void: #velocity.x = h_vel.x #velocity.z = h_vel.z #endregion + + +#region Winning +func _start_winning() -> void: + velocity = Vector3.ZERO + prev_velocity = velocity + collision_shape.disabled = true + + var tween = create_tween() + tween.set_process_mode(Tween.TWEEN_PROCESS_PHYSICS) + tween.tween_property(graphics, ^"scale", Vector3.ZERO, goal_animation_time) + tween.set_parallel(true) + tween.tween_property(graphics, ^"global_position", _entered_goal.global_position, goal_animation_time) +#endregion diff --git a/objects/canny_cat.tscn b/objects/canny_cat.tscn index be1cbb8..e11af30 100644 --- a/objects/canny_cat.tscn +++ b/objects/canny_cat.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://cybm74xwbsivx"] +[gd_scene load_steps=14 format=3 uid="uid://cybm74xwbsivx"] [ext_resource type="Texture2D" uid="uid://3i17aqnrspma" path="res://assets/textures/player/canny.png" id="1_cp4br"] [ext_resource type="Script" path="res://objects/canny_cat.gd" id="1_twfq8"] @@ -9,11 +9,8 @@ [ext_resource type="Script" path="res://addons/godot_state_charts/transition.gd" id="7_epv8h"] [ext_resource type="Script" path="res://addons/godot_state_charts/expression_guard.gd" id="8_d5slg"] -[sub_resource type="CylinderShape3D" id="CylinderShape3D_0aipe"] -height = 0.25 -radius = 0.55 - [sub_resource type="SphereShape3D" id="SphereShape3D_4o01j"] +radius = 0.45 [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2xpb7"] shading_mode = 0 @@ -35,7 +32,7 @@ resource_name = "Not Moving" script = ExtResource("8_d5slg") expression = "velocity.is_zero_approx()" -[node name="CannyCat" type="CharacterBody3D" node_paths=PackedStringArray("state_chart", "power_indicator", "camera_arm", "wall_detector")] +[node name="CannyCat" type="CharacterBody3D" node_paths=PackedStringArray("state_chart", "graphics", "power_indicator", "camera_arm", "collision_shape")] process_priority = -100 process_physics_priority = -100 collision_layer = 16 @@ -55,25 +52,31 @@ camera_high_angle = 1.0472 camera_yaw_sensitivity = 0.00872665 camera_pitch_sensitivity = 0.00872665 state_chart = NodePath("StateChart") +graphics = NodePath("Graphics") power_indicator = NodePath("PowerIndicator") camera_arm = NodePath("CameraArm") -wall_detector = NodePath("WallDetector") - -[node name="WallDetector" type="StaticBody3D" parent="."] -collision_layer = 0 - -[node name="CollisionShape3D" type="CollisionShape3D" parent="WallDetector"] -shape = SubResource("CylinderShape3D_0aipe") +collision_shape = NodePath("CollisionShape3D") [node name="CollisionShape3D" type="CollisionShape3D" parent="."] shape = SubResource("SphereShape3D_4o01j") -[node name="CannySprite" type="Sprite3D" parent="."] +[node name="Graphics" type="Node3D" parent="."] + +[node name="CannySprite" type="Sprite3D" parent="Graphics"] pixel_size = 0.0156 billboard = 1 texture_filter = 0 texture = ExtResource("1_cp4br") +[node name="ShadowArm" type="SpringArm3D" parent="Graphics"] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, -0.25, 0) +collision_mask = 7 +spring_length = 100.0 + +[node name="ShadowSprite" type="Sprite3D" parent="Graphics/ShadowArm"] +pixel_size = 0.0313 +texture = ExtResource("2_fwt6m") + [node name="PowerIndicator" type="Node3D" parent="."] visible = false @@ -84,15 +87,6 @@ cast_shadow = 0 gi_mode = 0 mesh = SubResource("CylinderMesh_b16dl") -[node name="ShadowArm" type="SpringArm3D" parent="."] -transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0) -collision_mask = 7 -spring_length = 100.0 - -[node name="ShadowSprite" type="Sprite3D" parent="ShadowArm"] -pixel_size = 0.0078 -texture = ExtResource("2_fwt6m") - [node name="CameraArm" type="SpringArm3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, 0, 0, 0) spring_length = 8.0 @@ -111,6 +105,12 @@ initial_expression_properties = { script = ExtResource("5_ox6hb") initial_state = NodePath("Moving") +[node name="on GoalEntered" type="Node" parent="StateChart/Root"] +script = ExtResource("7_epv8h") +to = NodePath("../Winning") +event = &"goal_entered" +delay_in_seconds = "0.0" + [node name="Idle" type="Node" parent="StateChart/Root"] script = ExtResource("6_bu01i") @@ -144,6 +144,9 @@ to = NodePath("../../Moving") event = &"charge_released" delay_in_seconds = "0.0" +[node name="Winning" type="Node" parent="StateChart/Root"] +script = ExtResource("6_bu01i") + [connection signal="state_physics_processing" from="StateChart/Root/Idle" to="." method="_apply_gravity"] [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"] @@ -151,3 +154,4 @@ delay_in_seconds = "0.0" [connection signal="state_entered" from="StateChart/Root/Charging" to="." method="_start_charge"] [connection signal="state_exited" from="StateChart/Root/Charging" to="." method="_end_charge"] [connection signal="state_physics_processing" from="StateChart/Root/Charging" to="." method="_update_charge"] +[connection signal="state_entered" from="StateChart/Root/Winning" to="." method="_start_winning"] diff --git a/objects/goal_post.gd b/objects/goal_post.gd new file mode 100644 index 0000000..21c8819 --- /dev/null +++ b/objects/goal_post.gd @@ -0,0 +1,7 @@ +class_name GoalPost +extends Node3D + + +func _on_player_detector_body_entered(body: Node3D) -> void: + if body is Player: + body.enter_goal(self) diff --git a/objects/goal_post.tscn b/objects/goal_post.tscn new file mode 100644 index 0000000..880dbcf --- /dev/null +++ b/objects/goal_post.tscn @@ -0,0 +1,70 @@ +[gd_scene load_steps=9 format=3 uid="uid://cdpgby3r6xe4n"] + +[ext_resource type="Script" path="res://objects/goal_post.gd" id="1_08x2x"] +[ext_resource type="Shader" path="res://assets/shaders/flag.gdshader" id="2_xbid5"] +[ext_resource type="Texture2D" uid="uid://cyxkbck2gs2wt" path="res://assets/textures/objects/goal_hole.png" id="3_yg6kd"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e2vbu"] +shading_mode = 2 +albedo_color = Color(0.196078, 0.235294, 0.223529, 1) +metallic_specular = 0.0 + +[sub_resource type="CylinderMesh" id="CylinderMesh_i27ie"] +material = SubResource("StandardMaterial3D_e2vbu") +top_radius = 0.1 +bottom_radius = 0.1 +height = 4.0 +radial_segments = 6 +rings = 8 + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_3urv4"] +render_priority = 0 +shader = ExtResource("2_xbid5") +shader_parameter/color_bright = Color(1, 0.290196, 0.356863, 1) +shader_parameter/color_dark = Color(0.870588, 0.156863, 0.223529, 1) +shader_parameter/pivot = 2.0 +shader_parameter/pivot_speed = 1.0 +shader_parameter/waves = 6.0 +shader_parameter/wave_speed = 5.0 +shader_parameter/wave_scale = 0.25 + +[sub_resource type="QuadMesh" id="QuadMesh_mfpmh"] +material = SubResource("ShaderMaterial_3urv4") +size = Vector2(2, 1) +subdivide_width = 6 +center_offset = Vector3(1, 0, 0) + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_eshe3"] +height = 0.5 + +[node name="GoalPost" type="Node3D"] +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, 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, 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.0313 +axis = 1 +alpha_cut = 2 +texture_filter = 0 +texture = ExtResource("3_yg6kd") + +[node name="PlayerDetector" type="Area3D" parent="."] +collision_layer = 0 +collision_mask = 16 +monitorable = false + +[node name="CollisionShape3D" type="CollisionShape3D" parent="PlayerDetector"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.25, 0) +shape = SubResource("CylinderShape3D_eshe3") + +[connection signal="body_entered" from="PlayerDetector" to="." method="_on_player_detector_body_entered"] diff --git a/project.godot b/project.godot index d3010a1..bef0700 100644 --- a/project.godot +++ b/project.godot @@ -19,7 +19,7 @@ config/icon="res://icon.svg" window/size/viewport_width=320 window/size/viewport_height=240 -window/stretch/mode="viewport" +window/stretch/mode="canvas_items" [editor_plugins] @@ -29,6 +29,10 @@ enabled=PackedStringArray("res://addons/godot_state_charts/plugin.cfg") import/blender/enabled=false +[global_group] + +friction_floor="" + [input] charge_shot={ diff --git a/test_scene.tscn b/test_scene.tscn index 65954a8..6cfc1a6 100644 --- a/test_scene.tscn +++ b/test_scene.tscn @@ -3,9 +3,7 @@ [ext_resource type="PackedScene" uid="uid://cybm74xwbsivx" path="res://objects/canny_cat.tscn" id="1_8qiqb"] [ext_resource type="MeshLibrary" uid="uid://cbs170roel08g" path="res://assets/mesh_libraries/w1/w1_floors.meshlib" id="2_ohutf"] [ext_resource type="MeshLibrary" uid="uid://bqxgr3arh0i7f" path="res://assets/mesh_libraries/w1/w1_walls.meshlib" id="3_k3r2h"] - -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_81x51"] -albedo_color = Color(0.305715, 0.658195, 0.299865, 1) +[ext_resource type="PackedScene" uid="uid://cdpgby3r6xe4n" path="res://objects/goal_post.tscn" id="4_71ems"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_akirf"] @@ -18,12 +16,6 @@ sky = SubResource("Sky_f657k") [node name="TestScene" type="Node3D"] -[node name="CSGBox3D" type="CSGBox3D" parent="."] -transform = Transform3D(1, 0, 0, 0, 0.983766, -0.179455, 0, 0.179455, 0.983766, 0, -1.59434, 7.28085) -use_collision = true -size = Vector3(20, 0.5, 20) -material = SubResource("StandardMaterial3D_81x51") - [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] transform = Transform3D(0.893065, 0.251134, -0.373318, 0, 0.82973, 0.558165, 0.449927, -0.498478, 0.741003, 0, 3.18312, 0) light_energy = 1.5 @@ -34,7 +26,18 @@ mesh_library = ExtResource("2_ohutf") cell_size = Vector3(1, 1, 1) cell_center_y = false data = { -"cells": PackedInt32Array(0, 0, 0, 0, 65535, 0, 65535, 65535, 0, 65535, 0, 0, 65534, 0, 0, 65534, 65535, 0, 65534, 65534, 0, 65535, 65534, 0, 0, 65534, 0, 1, 65534, 0, 1, 65535, 0, 1, 0, 0, 0, 1, 0, 65535, 1, 0, 65534, 1, 0, 1, 1, 0, 1, 2, 0, 0, 2, 0, 65535, 2, 0, 65534, 2, 0, 65533, 2, 0, 65533, 1, 0, 65533, 0, 0, 65533, 65535, 0, 65533, 65534, 0, 65533, 65533, 0, 65534, 65533, 0, 1, 65533, 0, 2, 65533, 0, 0, 65533, 0, 65535, 65533, 0, 2, 65534, 0, 2, 65535, 0, 2, 0, 0, 2, 1, 0, 3, 2, 0, 3, 1, 0, 3, 0, 0, 3, 65535, 0, 4, 65535, 0, 4, 65534, 1, 3, 65532, 0, 3, 65534, 0, 2, 65532, 0, 1, 65532, 0, 0, 65532, 0, 65535, 65532, 0, 65534, 65532, 0, 65533, 65532, 0, 65532, 65532, 0, 65532, 65533, 0, 65532, 65534, 0, 65532, 65535, 0, 65532, 1, 0, 65532, 0, 0, 65532, 2, 0, 65532, 3, 0, 65533, 3, 0, 65534, 3, 0, 65535, 3, 0, 1, 3, 0, 2, 3, 0, 3, 3, 0, 0, 3, 0, 4, 3, 0, 4, 2, 0, 4, 1, 0, 4, 0, 0, 2, 2, 0, 5, 4, 0, 4, 4, 0, 3, 4, 0, 2, 4, 0, 1, 4, 0, 0, 4, 0, 0, 5, 0, 65535, 5, 0, 65534, 5, 0, 65533, 5, 0, 65533, 4, 0, 65532, 4, 0, 65534, 4, 0, 65535, 4, 0, 3, 5, 0, 4, 5, 0, 5, 5, 0, 2, 5, 0, 1, 5, 0, 65532, 5, 0, 65531, 5, 0, 65531, 4, 0, 65531, 3, 0, 65531, 2, 0, 65531, 1, 0, 65530, 1, 0, 65530, 0, 0, 65530, 65535, 0, 65530, 65534, 0, 65530, 65533, 0, 65531, 65534, 0, 65531, 65535, 0, 65531, 0, 0, 65531, 65533, 0, 65531, 65532, 0, 65531, 65531, 0, 65532, 65531, 0, 65533, 65531, 0, 65534, 65531, 0, 65535, 65531, 0, 0, 65531, 0, 1, 65531, 0, 2, 65531, 0, 2, 65530, 0, 3, 65530, 0, 3, 65531, 0, 6, 65531, 0, 5, 65532, 1, 5, 65533, 1, 5, 65534, 1, 5, 65535, 1, 5, 1, 0, 5, 2, 0, 5, 3, 0, 6, 0, 0, 6, 65535, 0, 6, 65534, 0, 6, 65533, 1, 6, 65532, 1, 5, 0, 0, 7, 65535, 0, 7, 65534, 0, 8, 65533, 0, 8, 65534, 0, 7, 0, 0, 6, 1, 0, 6, 2, 0, 6, 4, 0, 6, 3, 0, 7, 2, 0, 7, 1, 0, 8, 1, 0, 8, 0, 0, 5, 65531, 1, 4, 65531, 1, 4, 65532, 1, 4, 65533, 1, 3, 65533, 1) +"cells": PackedInt32Array(0, 0, 0, 0, 65535, 0, 65535, 65535, 0, 65535, 0, 0, 65534, 0, 0, 65534, 65535, 0, 65534, 65534, 0, 65535, 65534, 0, 0, 65534, 0, 1, 65534, 0, 1, 65535, 0, 1, 0, 0, 0, 1, 0, 65535, 1, 0, 65534, 1, 0, 1, 1, 0, 1, 2, 0, 0, 2, 0, 65535, 2, 0, 65534, 2, 0, 65533, 2, 0, 65533, 1, 0, 65533, 0, 0, 65533, 65535, 0, 65533, 65534, 0, 65533, 65533, 0, 65534, 65533, 0, 0, 65533, 0, 65535, 65533, 0, 2, 0, 0, 2, 1, 0, 3, 2, 0, 3, 1, 0, 0, 65532, 0, 65535, 65532, 0, 65534, 65532, 0, 65533, 65532, 0, 65532, 65532, 0, 65532, 65533, 0, 65532, 65534, 0, 65532, 65535, 0, 65532, 1, 0, 65532, 0, 0, 65532, 2, 0, 65532, 3, 0, 65533, 3, 0, 65534, 3, 0, 65535, 3, 0, 1, 3, 0, 2, 3, 0, 3, 3, 0, 0, 3, 0, 4, 3, 0, 4, 2, 0, 4, 1, 0, 2, 2, 0, 5, 4, 0, 4, 4, 0, 3, 4, 0, 2, 4, 0, 1, 4, 0, 0, 4, 0, 0, 5, 0, 65535, 5, 0, 65534, 5, 0, 65533, 5, 0, 65533, 4, 0, 65532, 4, 0, 65534, 4, 0, 65535, 4, 0, 3, 5, 0, 4, 5, 0, 5, 5, 0, 2, 5, 0, 1, 5, 0, 65532, 5, 0, 65531, 5, 0, 65531, 4, 0, 65531, 3, 0, 65531, 2, 0, 65531, 1, 0, 65530, 1, 0, 65530, 0, 0, 65530, 65535, 0, 65530, 65534, 0, 65530, 65533, 0, 65531, 65534, 0, 65531, 65535, 0, 65531, 0, 0, 65531, 65533, 0, 65531, 65532, 0, 65531, 65531, 0, 65532, 65531, 0, 65533, 65531, 0, 65534, 65531, 0, 65535, 65531, 0, 0, 65531, 0, 6, 65531, 0, 5, 1, 0, 5, 2, 0, 5, 3, 0, 6, 0, 0, 6, 65535, 0, 6, 65534, 0, 5, 0, 0, 7, 65535, 0, 7, 65534, 0, 8, 65533, 0, 8, 65534, 0, 7, 0, 0, 6, 1, 0, 6, 2, 0, 6, 4, 0, 6, 3, 0, 7, 2, 0, 7, 1, 0, 8, 1, 0, 8, 0, 0) +} +metadata/_editor_floor_ = Vector3(0, 0, 0) + +[node name="FrictionFloor" type="GridMap" parent="." groups=["friction_floor"]] +mesh_library = ExtResource("2_ohutf") +cell_size = Vector3(1, 1, 1) +cell_center_y = false +collision_layer = 2 +collision_mask = 0 +data = { +"cells": PackedInt32Array(4, 0, 1, 3, 0, 1, 3, 65535, 1, 2, 65535, 1, 2, 65534, 1, 2, 65533, 1, 1, 65533, 1, 1, 65532, 1, 1, 65531, 1, 2, 65531, 1, 2, 65530, 1, 3, 65530, 1, 3, 65531, 1, 3, 65532, 1, 2, 65532, 1, 4, 65532, 1, 4, 65531, 1, 5, 65531, 1, 5, 65532, 1, 5, 65533, 1, 6, 65532, 1, 6, 65533, 1, 4, 65533, 1, 3, 65533, 1, 3, 65534, 1, 4, 65534, 1, 5, 65534, 1, 5, 65535, 1, 4, 65535, 1) } metadata/_editor_floor_ = Vector3(0, 0, 0) @@ -43,7 +46,7 @@ mesh_library = ExtResource("3_k3r2h") cell_size = Vector3(1, 1, 1) cell_center_y = false data = { -"cells": PackedInt32Array(65531, 65530, 0, 65532, 65530, 0, 65533, 65530, 0, 65534, 65530, 0, 65535, 65530, 0, 0, 65530, 0, 1, 65530, 0, 65530, 65530, 0, 65530, 65531, 0, 65530, 65532, 0, 65529, 65531, 0, 65529, 65532, 0, 65529, 65533, 0, 65529, 65534, 0, 65529, 65535, 0, 65529, 0, 0, 65529, 1, 0, 65529, 2, 0, 65530, 2, 0, 2, 65529, 1441792, 3, 65529, 1441792, 4, 65529, 1441792, 4, 65530, 1441792, 5, 65530, 1441792, 6, 65530, 1441792, 7, 65530, 1441792, 7, 65531, 1441792, 7, 65532, 1441792, 7, 65533, 1441792, 8, 65532, 1441792, 9, 65532, 1441792, 9, 65533, 1441792, 9, 65534, 1441792, 9, 65535, 1441792, 9, 0, 1441792, 8, 65535, 1441792, 9, 1, 1441792, 9, 2, 1441792, 8, 2, 1441792, 8, 3, 1441792, 7, 3, 1441792, 7, 4, 1441792, 7, 5, 1441792, 6, 5, 1441792, 6, 6, 1441792, 5, 6, 1441792, 4, 6, 1441792, 3, 6, 1441792, 2, 6, 1441792, 1, 6, 1441792, 0, 6, 1441792, 65535, 6, 1441792, 65534, 6, 1441792, 65533, 6, 1441792, 65532, 6, 1441792, 65531, 6, 1441792, 65530, 6, 1441792, 65530, 5, 1441792, 65530, 4, 1441792, 65530, 3, 1441792, 1, 65529, 1441792, 8, 65531, 0, 6, 65531, 0, 6, 65534, 0, 5, 0, 0) +"cells": PackedInt32Array(65531, 65530, 0, 65532, 65530, 0, 65533, 65530, 0, 65534, 65530, 0, 65535, 65530, 0, 0, 65530, 0, 1, 65530, 0, 65530, 65530, 0, 65530, 65531, 0, 65530, 65532, 0, 65529, 65531, 0, 65529, 65532, 0, 65529, 65533, 0, 65529, 65534, 0, 65529, 65535, 0, 65529, 0, 0, 65529, 1, 0, 65529, 2, 0, 65530, 2, 0, 2, 65529, 1441792, 3, 65529, 1441792, 4, 65529, 1441792, 4, 65530, 1441792, 5, 65530, 1441792, 6, 65530, 1441792, 7, 65530, 1441792, 7, 65532, 1441792, 7, 65533, 1441792, 8, 65532, 1441792, 9, 65532, 1441792, 9, 65533, 1441792, 9, 65534, 1441792, 9, 65535, 1441792, 9, 0, 1441792, 8, 65535, 1441792, 9, 1, 1441792, 9, 2, 1441792, 8, 2, 1441792, 8, 3, 1441792, 7, 3, 1441792, 7, 4, 1441792, 7, 5, 1441792, 6, 5, 1441792, 6, 6, 1441792, 5, 6, 1441792, 4, 6, 1441792, 3, 6, 1441792, 2, 6, 1441792, 1, 6, 1441792, 0, 6, 1441792, 65535, 6, 1441792, 65534, 6, 1441792, 65533, 6, 1441792, 65532, 6, 1441792, 65531, 6, 1441792, 65530, 6, 1441792, 65530, 5, 1441792, 65530, 4, 1441792, 65530, 3, 1441792, 1, 65529, 1441792, 6, 65534, 0, 5, 0, 0, 7, 65531, 1441792, 6, 65531, 1441792) } metadata/_editor_floor_ = Vector3(0, 0, 0) @@ -51,4 +54,25 @@ metadata/_editor_floor_ = Vector3(0, 0, 0) environment = SubResource("Environment_0oogp") [node name="CannyCat" parent="." instance=ExtResource("1_8qiqb")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.544784, 5.5043) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.926551, 3.63641) + +[node name="GoalPost" parent="." instance=ExtResource("4_71ems")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2, -2.38419e-07, -4) + +[node name="CanvasLayer" type="CanvasLayer" parent="."] + +[node name="SubViewportContainer" type="SubViewportContainer" parent="CanvasLayer"] +custom_minimum_size = Vector2(128, 128) +stretch = true + +[node name="s" type="SubViewport" parent="CanvasLayer/SubViewportContainer"] +transparent_bg = true +handle_input_locally = false +size = Vector2i(128, 128) +render_target_update_mode = 4 + +[node name="Camera3D" type="Camera3D" parent="CanvasLayer/SubViewportContainer/s"] +transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 2.545, 10, 0) +projection = 1 +current = true +size = 20.0