Skip to content

Add pet and annoy animations for cats and sheep - #2962

Merged
manuq merged 8 commits into
endlessm:mainfrom
MeLoNaCo:pets-interaction
Oct 7, 2026
Merged

manuq merged 8 commits into
endlessm:mainfrom
MeLoNaCo:pets-interaction

Conversation

@MeLoNaCo

@MeLoNaCo MeLoNaCo commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Cats now play a pet animation, while sheep play an annoy animation and turn away from the player.

Adds visual feedback for pet interactions. Make the sound effect also optional. If both are passed, the interact area is disabled until both finish playing. For that, move from using await to use signals with callbacks.

Document the PetInteraction class.

Add a configuration warning if the AnimatedSprite2D doesn't have an animation named "pet". Unfortunately this requires making the script a @tool.

Resolves #2220


Co-authored-by: Stephanie Vega tefsv.me@gmail.com

@MeLoNaCo
MeLoNaCo requested a review from a team as a code owner September 23, 2026 06:46
@MeLoNaCo MeLoNaCo changed the title Pets interaction Add pet and annoy animations for cats and sheep Sep 23, 2026
@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Test build no longer available.

@MeLoNaCo

Copy link
Copy Markdown
Contributor Author

@manuq @KarmDK

@Un-player0

Copy link
Copy Markdown
Contributor

Hi!
I've checked your changes and can confirm the pet and annoy animation work as intended

2026-09-24.11-50-17.mp4
2026-09-24.11-52-06.mp4

I would suggest moving face_away_behavior to scenes/game_elements/characters/npcs/components/ next to pet_interaction to keep both in the same place, or alternatively inside sheep/components

@manuq manuq left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

In general I'm a bit worried of PetInteraction becoming too complex for the 2 existing scenes using it, the cat and the sheep (well, also a townie in Dev Archipelago!). Maybe we should pause and frame what this node about. A simple "no code" way to react to an interaction?

  • Play sound effect.
  • Play animation.
  • Shake.
  • Increment a fact counter.

If you agree, I will document the PetInteaction class with the above. For behaviors that require custom code like the sheep facing away, it would be easier to do them just by connecting to interaction_started of the InteractArea directly.

if fact_counter:
fact_counter.increment()
await sound_effect_player.finished
if interaction_behavior and interaction_behavior.has_method(&"apply"):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the function arguments, there is one called _from_right:

func _on_interact_area_interaction_started(player: Player, _from_right: bool) -> void:

You can use it to flip the sprite, instead of calculating it again in apply().

"texture": SubResource("AtlasTexture_6jekj")
}],
"loop": 0,
"name": &"annoy",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency, maybe the animation name should be called "pet" even if we are annoying the sheep. The node name is PetInteraction.


func apply(player: Player, pet_animation: AnimatedSprite2D) -> void:
var player_is_on_right := player.global_position.x > pet_animation.global_position.x
var parent_is_flipped := pet_animation.global_transform.x.x < 0.0

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why you added this. Some sheeps are flipped horizontally by scale.x = -1. For example in Fray's End West:

Image

I like that you made this a behavior, although one specific to the sheep. It should go inside a components folder: scenes/game_elements/props/decoration/sheep/components/

Also I find it a bit indirect that InteractArea emits a signal, then PetInteraction captures it and calls apply on this. This behavior could be connected to InteractArea.interaction_started directly. Please do so.

@manuq

manuq commented Sep 28, 2026

Copy link
Copy Markdown
Collaborator

I would suggest moving face_away_behavior to scenes/game_elements/characters/npcs/components/ next to pet_interaction to keep both in the same place, or alternatively inside sheep/components

Thanks for your review, @Un-player0 ! Yes, I would say sheep/components.

@manuq

manuq commented Oct 6, 2026

Copy link
Copy Markdown
Collaborator

@MeLoNaCo hi! Are you still around to do the changes suggested above?

@manuq
manuq force-pushed the pets-interaction branch from 9af47a5 to f3cd602 Compare October 7, 2026 17:51
@manuq

manuq commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

I made the changes myself this time. And also:

  • Changed the use of await in favor of signal callbacks. So the interact area is re-enabled after the sound or animation (or both) finish playing.
  • Made the behaviors to disable a bit more generic.
  • Documented the PetInteraction class.
  • Added a configuration warning if the AnimatedSprite2D doesn't have an animation named "pet". Unfortunately this requires making the script a @tool.

@manuq
manuq merged commit 34a5646 into endlessm:main Oct 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add visual response to annoying sheep/petting cat

4 participants