CompiledFrog

Post #36: A Solved Mystery Brings More Questions

Thanks to everyone who responded with ideas to my Post #28: A Failed Refactoring. I dug into this today and found the reason why the signals for the mouse events weren't firing 🎉

The Result

Here is the mouse collision with the card working. When the mouse enters the card boundaries, the card sticks to the mouse and follows it. (This is just experimental, the actual game won't work like this.)

The Solution

I created two different test projects, one that used a Panel, and one that used an Area2D. I was able to set up the signals correctly for both test projects. This verified there was no bug; my original project was just doing something wrong. But, these tests shed light on what was wrong with my original "War Card Game".

The core issue was that something else was stealing the mouse events; which, in this case, was the background ColorRect I was using. The easy fix was to prevent the ColorRect from stealing the mouse events. You can do this with nodes if they have the Control > Mouse > Filter property:

Post36-Photo3_2026-06-28_compiledfrog

As you can see above, you should set the Filter key to Pass (Propagate Up) (or maybe Ignore, depending on your use case?). This allows the mouse events to be passed to the node that was actually listening for mouse events.

More Questions

A solved mystery often brings more questions. While these answers are probably easily found in the docs, I'll write the questions down so I can remember what I ran into (if you have the answers, please send me links!). The main two questions are really just me wanting to verify that the knowledge I've seen during my testing is legitimate:

  1. Within the scene tree, nodes "lower" in the tree are drawn on top visually (higher z index)
  2. Within the scene tree, nodes "higher" in the tree receive mouse events first

Post36-Photo4_2026-06-28_compiledfrog

I want to verify if those are accurate. If so, why do they work differently? Why not be consistent with how mouse events are handled, starting with items on top visually on the screen?

Learning is an awesome thing. Thanks for reading and joining along for the journey.