Add keycard pickup, keycard reader, and unlockable door #38

Merged
noahg merged 9 commits from noahg/add-keycard-and-keycard-reader-unlockable-door into dev 2026-03-14 18:25:28 +00:00
Member
Implements https://tasks.bugjam.dev/tasks/165
@ -5,0 +5,4 @@
## The [b]local[/b] direction the player must be from this area to be able to interact with it.
## [br]Must be set to one of [constant Vector3i.ZERO], [constant Vector3i.LEFT], [constant Vector3i.RIGHT], [constant Vector3i.UP], [constant Vector3i.DOWN], [constant Vector3i.FORWARD], or [constant Vector3i.BACK]
## [br][b]Note:[/b] When set to [constant Vector3i.ZERO] this area can be interacted with from any direction
@export var _interaction_direction: Vector3i = Vector3i.UP:
Member

Would this work better as an enum?

enum InteractionDirection {
	ANY,
	LEFT,
	RIGHT,
	UP,
	DOWN,
	FORWARD,
	BACK,
}

@export var interaction_direction: InteractionDirection = InteractionDirection.ANY


func interaction_direction_to_vector(direction: InteractionDirection) -> Vector3:
	match direction:
		InteractionDirection.ANY:
			return Vector3.ZERO
		InteractionDirection.LEFT:
			return Vector3.LEFT
		InteractionDirection.RIGHT:
			return Vector3.RIGHT
		InteractionDirection.UP:
			return Vector3.UP
		InteractionDirection.DOWN:
			return Vector3.DOWN
		InteractionDirection.FORWARD:
			return Vector3.FORWARD
		InteractionDirection.BACK:
			return Vector3.BACK
		_:
			return Vector3.ZERO
Would this work better as an enum? ```gdscript enum InteractionDirection { ANY, LEFT, RIGHT, UP, DOWN, FORWARD, BACK, } @export var interaction_direction: InteractionDirection = InteractionDirection.ANY func interaction_direction_to_vector(direction: InteractionDirection) -> Vector3: match direction: InteractionDirection.ANY: return Vector3.ZERO InteractionDirection.LEFT: return Vector3.LEFT InteractionDirection.RIGHT: return Vector3.RIGHT InteractionDirection.UP: return Vector3.UP InteractionDirection.DOWN: return Vector3.DOWN InteractionDirection.FORWARD: return Vector3.FORWARD InteractionDirection.BACK: return Vector3.BACK _: return Vector3.ZERO ````
Author
Member

It definitely would! Thanks for the suggestion. I just made the change. I also added comments to each value to show which vector it is equivalent to in the editor hint. Hopefully it helps make it clearer how to deal with the two counter intuitive values of FORWARD and BACK because of Godot's coordinate system having Z be negative for forward.

It definitely would! Thanks for the suggestion. I just made the change. I also added comments to each value to show which vector it is equivalent to in the editor hint. Hopefully it helps make it clearer how to deal with the two counter intuitive values of `FORWARD` and `BACK` because of Godot's coordinate system having Z be negative for forward.
noahg marked this conversation as resolved
noahg force-pushed noahg/add-keycard-and-keycard-reader-unlockable-door from 3dc50d3e7b to fbd80994c1 2026-03-14 16:56:31 +00:00 Compare
noahg deleted branch noahg/add-keycard-and-keycard-reader-unlockable-door 2026-03-14 18:25:29 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
BUGJam/pounce-game!38
No description provided.