InteractArea: Set debug color on shapes - #2678
Conversation
3095e64 to
1a8e0fa
Compare
|
Play this branch at https://play.threadbare.game/branches/endlessm/wjt/interactarea-set-debug-color-on-shapes/. (This launches the game from the start, not directly at the change(s) in this pull request.) |
|
|
||
| func _notification(what: int) -> void: | ||
| match what: | ||
| NOTIFICATION_CHILD_ORDER_CHANGED when Engine.is_editor_hint() and is_node_ready(): |
There was a problem hiding this comment.
Oh first time I see when in GDScript! I didn't know match had it, I would have written this as nested if conditionals.
There was a problem hiding this comment.
I have to look up the match syntax every time I use it, so I see this form in the documentation every time as well. (Also I first came across pattern matching in Haskell where pattern guards like this are very common.)
| ## Emitted when characters start or stop seeing this area for interaction. | ||
| signal observers_changed | ||
|
|
||
| const SHAPE_DEBUG_COLOR := Color(0.6, 0.545, 0.0, 0.42) |
There was a problem hiding this comment.
Not for this PR, but if we add more color codes (like purple for hookable areas) we may want to have them all in a single file. Maybe in a const SHAPE_DEBUG_COLORS: Dictionary[StringName, Color].
|
I haven't resaved all scenes with this change applied, hence draft. I actually have a script lying around in my inventory branch to rewrite all scenes in the project that use a particular scene. I should be able to do something similar for scenes that use a particular script to do this programmatically. Maybe I can generalise it... |
1a8e0fa to
9468296
Compare
Oh it would be great to have it under |
manuq
left a comment
There was a problem hiding this comment.
Confirmed that NOTIFICATION_CHILD_ORDER_CHANGED works like a charm to update the color in a @tool script.
Use a consistent yellow color for all collision shapes that define an InteractArea (that is, their CollisionShape2D immediate children), so they are easy to identify in the editor.