Make cat walk around - #2901
Make cat walk around#2901
Conversation
|
Hi! I completed all requirements for the task, I think, but the cat sprite currently only faces right while walking. What's the preferred way to flip the sprite here? |
|
Test build no longer available. |
scenes/game_logic/sprite_behaviors/character_sprite_behavior.gd
I don't think we should use up a whole new layer for this. If we're happy to let the cat roam the whole map, but not let it escape, we can place some invisible colliders that block NPCs (the cat is an NPC) at the boundaries of the map. If you want to confine the cat to a smaller area you could use a NavigationRegion and pathfind within that. But personally I think "whole map, block exits" would be fine for an erratic walk. |
|
Hi, thanks for the feedback! The changes have been made and the PR description is updated. Everything is all set now. |
wjt
left a comment
There was a problem hiding this comment.
Great fun! Just a few little changes.
I think we put him in his current position when he was a static asset with no interactive behaviours, so he was a bit out of the way:
Now that he moves around, he tends to get stuck in this corner because he's tucked away between lots of objects he can collide with. Maybe that's OK – he's hanging around his home, and only occasionally goes exploring!
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_gm6tl"] | ||
| size = Vector2(28, 320) | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_6fau3"] | ||
| size = Vector2(33, 195) | ||
|
|
||
| [sub_resource type="RectangleShape2D" id="RectangleShape2D_u5bk5"] | ||
| size = Vector2(334.125, 49) |
There was a problem hiding this comment.
I think these need to be a bit further out, outside the camera bounds (the yellow box). Because the player can also collide with them, these mean that the player no longer walks off screen when you move out of fray's end:
Screencast.From.2026-09-18.09-38-17.mp4
Try moving the barrier outside the camera limits.
I also think they should be in the "walls" layer not the "npcs" layer.
| 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] |
| [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]] |
There was a problem hiding this comment.
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 cat.gd script attached to the root node, but don't feel you have to change it.)
|
I set the cat boundaries to Layer 6 (interactable). This keeps the cat contained without blocking the player on the bridge or exits, and it fits well since the cat is an interactable NPC. I also moved the cat to a more open area so it has more room to wander. |
|
This looks great! Grabacion.de.pantalla.desde.2026-09-22.12-37-20.mp4 |
| script = ExtResource("6_0bwy3") | ||
| prefix = "cats_petted" | ||
|
|
||
| [node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=1636558305] |
There was a problem hiding this comment.
I think that this works well just with the CharacterSpriteBehavior set to play animations. Please:
- Remove AnimationPlayer and CharacterAnimationPlayerBehavior nodes
- Reset play animations in CharacterSpriteBehavior to the default (on)
|
Actually I was able to do the requested changes myself. Thank you @IDynamixI985 ! |







Makes the cat walk around Fray's End.
frays_end.tscn): Added aStaticBody2D(CatLimit) using layer 2 (npcs) at the map exits, positioned so they block the cat from escaping without obstructing the player's path.cat.tscn): Added%ErraticWalkBehavior(with speeds and travel distance set) and a%Timer(2s, one-shot, autostart) to control walk and idle cycles.%Timer.timeoutenables%ErraticWalkBehavior.%ErraticWalkBehavior.direction_changeddisables walk behavior, resetsvelocityto zero (triggers idle animation), and restarts%Timer.%InteractArea.interaction_startedstops movement and the timer while being petted;interaction_endedrestarts%Timer.Resolves: #1290