Create "secret path" tool for semi-hidden access to dev island#2526
Create "secret path" tool for semi-hidden access to dev island#2526felixwalberg wants to merge 9 commits into
Conversation
Screen.Recording.2026-07-07.at.4.50.54.PM.mov |
|
Play this branch at https://play.threadbare.game/branches/endlessm/dev-island-access/. (This launches the game from the start, not directly at the change(s) in this pull request.) |
manuq
left a comment
There was a problem hiding this comment.
In general I think this is a bit overengineered for what is possibly a one-off. I would:
- Setup an array of CanvasItems to disable / modulate
- Add an Area2D to detect the player and a callback for body_entered / body_exited
- When the player enters/exits, flip the collision shapes used in the forest StaticBody2D. That is, enable different CollisionPolygon2Ds that have the access, disable the one that doesn't have the access.
- Also, when the player enters/exits, change processing mode on the array of CanvasItems that was setup.
- Maybe even do all this with AnimationPlayer, so a smooth animation of the modulate value is possible.
| # TODO: Change to item you want to walk past (in inspector) | ||
| # TODO: we also would need tree to have a class_name or some other way to generalize this | ||
| const TREE_SCENE = preload("res://scenes/game_elements/props/tree/components/tree.gd") |
There was a problem hiding this comment.
Why constrain this to a single class? What this script does for opening the access is:
- Set the tree in PROCESS_MODE_DISABLED
- Change the tree modulate to make it semi-transparent.
And since modulate is a property of CanvasItem, this could work with any CanvasItem.
Also the "WalkableTrees" Area2D is used for 2 things:
- For detecting the player and opening the access.
- For setup of the items to disable and modulate.
I think that this coupling is a bit constraining, and is a bit tricky to setup the items at run-time, using the body_entered signal. If you leave the Area2D just for detecting the player, you could do the setup of items just by exporting an Array of CanvasItems. Something like:
## Items you want to walk past
@export var items: Array[CanvasItem]
Although it will be hard to setup, and has to be done each time AreaFiller "Refill" is pressed. For that a @export_tool_button could be added. Or alternatively, export the parent node and traverse all immediate children, matching CanvasItems.
## Parent of items you want to walk past. Each CanvasItem immediate children
@export var parent_of_items: Node2D
| @export_range(10, 1000, 10) var width: float = 200.0: | ||
| set = _set_width_values | ||
|
|
||
| @export_range(10, 1000, 10) var height: float = 400.0: | ||
| set = _set_height_values |
There was a problem hiding this comment.
This is limiting, because the Area2D and its collision shape are inside the tree_parter scene. So:
- It constrains to a rectangle shape.
- And the rectangle shape can't be modified in the 2D viewport, only by these width, height sliders in the Inspector.
Instead, you can remove the Area2D from tree_parter and add an @export for it. You could check how other "behavior" scripts do it.
Oh, but I see now that this also has to adjust the borders according to the width and height! Looks a bit overengineered (I'll explain in a few).
| for tree in trees: | ||
| tree.process_mode = Node.PROCESS_MODE_DISABLED | ||
| tree.get_parent().modulate = SECRET_PATH_MODULATION | ||
| audio_stream_player_2d.play() | ||
| for collider in colliders: | ||
| collider.process_mode = Node.PROCESS_MODE_DISABLED |
There was a problem hiding this comment.
I'm pretty sure that setting process_mode = Node.PROCESS_MODE_DISABLED on the tree will also set it on all its child nodes like the collider (if they are setup with Node.PROCESS_MODE_INHERIT). So I wonder if you need the extra colliders array at all.
| elif body.get_parent().get_script() == TREE_SCENE: | ||
| trees.append(body) | ||
| else: | ||
| colliders.append(body) |
There was a problem hiding this comment.
This relies on doing the setup of trees and colliders at run-time when the scene is started and body_entered is called with them.

Add a tool to disable collisions when the player enters the area. Modulates trees within the area to simulate a secret passage within the forest. A possible way for us to style the entry point to Dev Island somewhere in Fray's End (video in comments).
Questions/Concerns/Ideas
class_nameto the tree scene, or does that introduce too much complexity? My current check if a node is a tree is pretty hackydev_island.tscnbe stored? Among the LoreQuests?tree_parter.tscn,tree_parter.gd, andtree_parter_test.tscnbe stored?tree_parter.tscnand could be toggled off when not needed. This would avoid having to drag the teleporter shape into the correct spot, and it would dynamically resize with the tree_parter itselfAddresses one component of #2108