-
Notifications
You must be signed in to change notification settings - Fork 502
Make cat walk around #2901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make cat walk around #2901
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,13 @@ | |
|
|
||
| [ext_resource type="Script" uid="uid://cms2wqtbxjl1h" path="res://scenes/game_logic/sprite_behaviors/random_frame_sprite_behavior.gd" id="2_t04tf"] | ||
| [ext_resource type="SpriteFrames" uid="uid://caou2u7vffhei" path="res://scenes/game_elements/characters/npcs/cat/components/cat.tres" id="3_qosq0"] | ||
| [ext_resource type="Script" uid="uid://dy68p7gf07pi3" path="res://scenes/game_logic/sprite_behaviors/character_sprite_behavior.gd" id="3_ymecv"] | ||
| [ext_resource type="Script" uid="uid://du8wfijr35r35" path="res://scenes/game_elements/props/interact_area/interact_area.gd" id="4_8kxh7"] | ||
| [ext_resource type="Script" uid="uid://djeshbrs3vwnb" path="res://scenes/game_elements/characters/npcs/components/pet_interaction.gd" id="4_t04tf"] | ||
| [ext_resource type="AudioStream" uid="uid://di2b2rgca1udv" path="res://scenes/game_elements/characters/npcs/cat/components/412017__skymary__cat-meow-short.wav" id="5_t04tf"] | ||
| [ext_resource type="Script" uid="uid://dxvv340yej4py" path="res://scenes/game_logic/fact_counter/fact_counter.gd" id="6_0bwy3"] | ||
| [ext_resource type="Script" uid="uid://cx0sk4uhvnii0" path="res://scenes/game_logic/walk_behaviors/erratic_walk_behavior.gd" id="9_gm6tl"] | ||
| [ext_resource type="Script" uid="uid://csev4hv57utxv" path="res://scenes/game_logic/walk_behaviors/character_speeds.gd" id="10_i6tmh"] | ||
|
|
||
| [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_3vyb7"] | ||
| height = 26.0 | ||
|
|
@@ -18,8 +21,18 @@ random_pitch = 1.15 | |
| streams_count = 1 | ||
| stream_0/stream = ExtResource("5_t04tf") | ||
|
|
||
| [sub_resource type="Resource" id="Resource_u5bk5"] | ||
| script = ExtResource("10_i6tmh") | ||
| walk_speed = 70.0 | ||
| run_speed = 70.0 | ||
| stopping_step = 200.0 | ||
| moving_step = 150.0 | ||
| stuck_speed = 70.0 | ||
| metadata/_custom_type_script = "uid://csev4hv57utxv" | ||
|
|
||
| [node name="Cat" type="CharacterBody2D" unique_id=1950923165] | ||
| collision_layer = 2 | ||
| collision_mask = 531 | ||
| motion_mode = 1 | ||
|
|
||
| [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=556665806] | ||
|
|
@@ -35,11 +48,17 @@ script = ExtResource("2_t04tf") | |
| sprite = NodePath("..") | ||
| metadata/_custom_type_script = "uid://cms2wqtbxjl1h" | ||
|
|
||
| [node name="CharacterSpriteBehavior" type="Node2D" parent="AnimatedSprite2D" unique_id=750356762 node_paths=PackedStringArray("character", "sprite")] | ||
| script = ExtResource("3_ymecv") | ||
| character = NodePath("../..") | ||
| sprite = NodePath("..") | ||
|
|
||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=557938036] | ||
| rotation = -1.5708 | ||
| shape = SubResource("CapsuleShape2D_3vyb7") | ||
|
|
||
| [node name="InteractArea" type="Area2D" parent="." unique_id=1432241865] | ||
| unique_name_in_owner = true | ||
| collision_layer = 32 | ||
| collision_mask = 0 | ||
| script = ExtResource("4_8kxh7") | ||
|
|
@@ -65,3 +84,27 @@ fact_counter = NodePath("../FactCounter") | |
| [node name="FactCounter" type="Node" parent="." unique_id=539544383] | ||
| script = ExtResource("6_0bwy3") | ||
| prefix = "cats_petted" | ||
|
|
||
| [node name="ErraticWalkBehavior" type="Node2D" parent="." unique_id=453552834 node_paths=PackedStringArray("character")] | ||
| unique_name_in_owner = true | ||
| process_mode = 4 | ||
| script = ExtResource("9_gm6tl") | ||
| speeds = SubResource("Resource_u5bk5") | ||
| travel_distance = 350.0 | ||
| character = NodePath("..") | ||
| metadata/_custom_type_script = "uid://cx0sk4uhvnii0" | ||
|
|
||
| [node name="Timer" type="Timer" parent="." unique_id=352204476] | ||
| unique_name_in_owner = true | ||
| wait_time = 2.0 | ||
| one_shot = true | ||
| autostart = true | ||
|
|
||
| [connection signal="interaction_ended" from="InteractArea" to="Timer" method="start"] | ||
| [connection signal="interaction_started" from="InteractArea" to="Timer" method="stop" unbinds=2] | ||
| [connection signal="interaction_started" from="InteractArea" to="." method="set_velocity" unbinds=2 binds= [Vector2(0, 0)]] | ||
| [connection signal="interaction_started" from="InteractArea" to="ErraticWalkBehavior" method="set_process_mode" unbinds=2 binds= [4]] | ||
| [connection signal="direction_changed" from="ErraticWalkBehavior" to="Timer" method="start"] | ||
| [connection signal="direction_changed" from="ErraticWalkBehavior" to="." method="set_velocity" binds= [Vector2(0, 0)]] | ||
| [connection signal="direction_changed" from="ErraticWalkBehavior" to="ErraticWalkBehavior" method="set_process_mode" binds= [4]] | ||
| [connection signal="timeout" from="Timer" to="ErraticWalkBehavior" method="set_process_mode" binds= [0]] | ||
|
Comment on lines
+103
to
+110
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wow, I didn't expect all this to be done in the scene editor! Very clever. (I think it might be clearer to set this all up in code, with a |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -153,5 +153,5 @@ animations = [{ | |
| }], | ||
| "loop": 1, | ||
| "name": &"walk", | ||
| "speed": 5.0 | ||
| "speed": 10.0 | ||
| }] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -101,6 +101,21 @@ _data = { | |
| } | ||
| point_count = 4 | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_gm6tl"] | ||
| size = Vector2(28, 320) | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_6fau3"] | ||
| size = Vector2(33, 217) | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_bu3x1"] | ||
| size = Vector2(341.5, 14.5) | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_u5bk5"] | ||
| size = Vector2(65, 49) | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_ojao8"] | ||
| size = Vector2(65, 49) | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_qgpx3"] | ||
| size = Vector2(320, 64) | ||
|
|
||
|
|
@@ -497,7 +512,7 @@ character_seed = 3363471871 | |
| look_at_side = 1 | ||
|
|
||
| [node name="Cat" parent="OnTheGround/NPCs" unique_id=1091997689 instance=ExtResource("52_ppslc")] | ||
| position = Vector2(267, 642) | ||
| position = Vector2(1383, 687) | ||
|
|
||
| [node name="BeachTownie" parent="OnTheGround/NPCs" unique_id=1268570065 instance=ExtResource("54_duxxr")] | ||
| position = Vector2(2719, 1720) | ||
|
|
@@ -838,6 +853,30 @@ position = Vector2(969.4194, 2045.982) | |
| scale = Vector2(1.1060888, 1.0290669) | ||
| polygon = PackedVector2Array(-877.343, -208.91, -817.673, -167.124, -758.004, -191.418, -697.43, -150.605, -638.664, -170.04, -579.899, -209.882, -460.559, -201.136, -390.04, -228.345, -324.042, -206.966, -255.332, -160.322, -168.539, -205.023, -99.8287, -193.362, -2.18738, -175.87, 55.6742, -183.644, 109.919, -223.486, 171.397, -226.401, 217.506, -200.164, 320.572, -186.559, 404.652, -186.559, 505.005, -189.475, 517.662, -237.091, 589.455, -238.273, 670.946, -241.251, 812.201, -217.423, 889.163, -140.978, 974.222, 0.017334, -874.675, -0.992798) | ||
|
|
||
| [node name="CatLimit" type="StaticBody2D" parent="OnTheGround" unique_id=1094201463] | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| collision_layer = 32 | ||
| collision_mask = 0 | ||
|
|
||
| [node name="CollisionShape2D" type="CollisionShape2D" parent="OnTheGround/CatLimit" unique_id=65509031] | ||
| position = Vector2(52, 737) | ||
| shape = SubResource("RectangleShape2D_gm6tl") | ||
|
|
||
| [node name="CollisionShape2D2" type="CollisionShape2D" parent="OnTheGround/CatLimit" unique_id=252151575] | ||
| position = Vector2(2959, 862.5) | ||
| shape = SubResource("RectangleShape2D_6fau3") | ||
|
|
||
| [node name="CollisionShape2D3" type="CollisionShape2D" parent="OnTheGround/CatLimit" unique_id=206951936] | ||
| position = Vector2(2524, 7.75) | ||
| shape = SubResource("RectangleShape2D_bu3x1") | ||
|
|
||
| [node name="CollisionShape2D4" type="CollisionShape2D" parent="OnTheGround/CatLimit" unique_id=1006129908] | ||
| position = Vector2(2658, 1977) | ||
| shape = SubResource("RectangleShape2D_u5bk5") | ||
|
|
||
| [node name="CollisionShape2D5" type="CollisionShape2D" parent="OnTheGround/CatLimit" unique_id=1596236520] | ||
| position = Vector2(992, 1287) | ||
| shape = SubResource("RectangleShape2D_ojao8") | ||
|
|
||
| [node name="Trees" type="Node2D" parent="OnTheGround" unique_id=378434157] | ||
| y_sort_enabled = true | ||
| metadata/_edit_lock_ = true | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The cat can walk on water! You need to change his collision_mask to include
non_walkable_floor.