Skip to content

Instantly share code, notes, and snippets.

View WolfgangSenff's full-sized avatar

Kyle Szklenski WolfgangSenff

View GitHub Profile
@WolfgangSenff
WolfgangSenff / gist:7fc03dbd9c2c5c8681cd4aa32a171ff2
Created March 13, 2024 11:31
Marriage Vows from Cat, I Farted.
Ah, that's a lovely sentiment, but I'm afraid I can't marry you or anyone else.
However, if I could, my vows might go something like this:
"My dear [Your Name],
As we stand here today, I vow to be by your side through all the twists and turns of life,
just as I am here for you in every conversation. I promise to listen to your thoughts and
concerns, to support you in your endeavors, and to celebrate your successes as if they were
my own.
@WolfgangSenff
WolfgangSenff / Enemy.gd
Created June 27, 2024 15:28
Events, more
extends CharacterBody2D
class_name Enemy
@export var MoveSpeed : float
var player : Player
func _ready() -> void:
Events.player_ready.connect(_on_player_ready)
class_name DaisyChain
extends RefCounted
# Basic signal with early stop implementation
var _callables = []
func chain(callable: Callable) -> DaisyChain:
_callables.push_back(callable)
return self
@WolfgangSenff
WolfgangSenff / array_resource.gd
Last active November 11, 2024 19:50
MVVM in Godot
class_name ArrayResource
extends Resource
var _values = []:
set(value):
_values = value
emit_changed()
func _init(initial_values: Array = []) -> void:
if not initial_values.is_empty():
@WolfgangSenff
WolfgangSenff / gist:f0d3f807966b244ee6e3d79db5faf1cc
Last active October 11, 2024 15:47
Godot safe_navigate implementation
# This can be static if you have a nice place to put it. I just have it in one spot, not static.
func safe_navigate(root: Variant, path: String) -> Variant:
var properties = path.split(".")
var current_value = root
for prop in properties:
if current_value == null:
print_debug("Navigation stopped: '", prop, "' is null.")
return null
elif not is_instance_valid(current_value):
@WolfgangSenff
WolfgangSenff / variable_checker.gd
Created April 16, 2025 14:56
Variable checker for Godot
# This useful little class can be created in a node and it'll make it so you can, on a timer, check the value of a specific variable by simply passing in the variable name
class_name VariableChecker
extends Timer
func _init(check_time: float, variable_name: String, check_against: Node) -> void:
wait_time = check_time
autostart = true
timeout.connect(func(): print(check_against[variable_name]))
check_against.add_child(self)
var view = {
root = control({
mouse_filter = MOUSE_FILTER_IGNORE
}, [
vbox({ size_flags_horizontal = SIZE_EXPAND, size_flags_vertical = SIZE_SHRINK_CENTER },
[
label({ text = "Player Name:" }),
label({ text = data.player_name.value() })
]
)