Skip to content

Instantly share code, notes, and snippets.

View WolfgangSenff's full-sized avatar

Kyle Szklenski WolfgangSenff

View GitHub Profile
@WolfgangSenff
WolfgangSenff / gist:168cb0cbd486c8c9cd507f232165b976
Last active December 19, 2025 12:36
Godot 4.0 Migration/Upgrade guide
## For a beginner-friendly version of the following (more advanced users likely will get better use of the below,
## if you're just starting out...), see this new gist:
## https://gist.github.com/WolfgangSenff/0a9c1d800db42a9a9441b2d0288ed0fd
This document represents the beginning of an upgrade or migration document for GDScript 2.0 and Godot 4.0. I'm focusing on 2D
at the moment as I'm upgrading a 2D game, but will hopefully have more to add for 3D afterward.
## If you want more content like this, please help fund my cat's medical bills at https://ko-fi.com/kyleszklenski - thank you very much! On to the migration guide.
@WolfgangSenff
WolfgangSenff / gist:54c873a696eaf465a8cb2cc859cff782
Last active December 9, 2025 13:36
Any script with class_name template
# meta-name: ClassNamed
# meta-description: Auto-class_name anything
class_name _CLASS_
extends _BASE_
# To use: in a Godot project, add a script_templates folder, add a sub-folder of it named Object, and copy/paste the above into a file named class_named.gd.
# Then, when creating a new resource, have it inherit Resource in the editor for the new script creation, and tap on the checkbox next to template, and select the new ClassNamed template. When you give it a name for the .gd file, it'll put the name instead of _CLASS_. This works for any type you want to add.
var db_ref
func _ready() -> void:
Firebase.Auth.login_succeeded.connect(_on_FirebaseAuth_login_succeeded)
Firebase.Auth.login_with_email_and_password(email, password)
func _on_FirebaseAuth_login_succeeded(auth):
db_ref = Firebase.Database.get_database_reference("config", {})
db_ref.new_data_update.connect(_on_db_data_update)
db_ref.patch_data_update.connect(_on_db_data_update)
@WolfgangSenff
WolfgangSenff / button_group_container.gd
Last active September 3, 2025 16:34
button_group_container.gd
extends Container # Can make this extend any type you want, and give it an appropriate name accordingly
class_name ButtonGroupContainer
var _group = ButtonGroup.new()
func _ready() -> void:
for child in get_children():
if child is BaseButton:
child.toggle_mode = true
child.button_group = _group
@WolfgangSenff
WolfgangSenff / compile_android_all_mac.sh
Last active July 9, 2025 13:15
Build script for entire Android stack on a Mac for Godot 3.x
#!/bin/bash
# Build engine
scons platform=osx arch=arm64
# Build Android code
scons platform=android target=release android_arch=armv7
scons platform=android target=release_debug android_arch=armv7
scons platform=android target=release android_arch=arm64v8
@WolfgangSenff
WolfgangSenff / firestore_document.gd
Last active July 3, 2025 13:23
Test new Firestore document listeners
## @meta-authors Kyle Szklenski
## @meta-version 2.2
## A reference to a Firestore Document.
## Documentation TODO.
@tool
class_name FirestoreDocument
extends Node
# A FirestoreDocument objects that holds all important values for a Firestore Document,
# @doc_name = name of the Firestore Document, which is the request PATH
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() })
]
)
@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)
@WolfgangSenff
WolfgangSenff / gist:0a9c1d800db42a9a9441b2d0288ed0fd
Last active February 15, 2025 13:47
GDScript 1.0 to 2.0 Beginner Friendly Conversion Guide
Beginner-friendly GDScript 1 to GDScript 2 Conversion Guide
First and foremost, this should not be considered a replacement for the official migration guide,
found at https://docs.godotengine.org/en/latest/tutorials/migrating/upgrading_to_godot_4.html!
Instead, this document is intended to be a friendly guide to helping you upgrade your projects from
GDScript 1 to 2. To do this, I'm going to list the most common conversions I've run into while upgrading
a few of my games and tools. This document is written as of the first release candidate version of Godot 4.0.
The first thing to do when converting a project (no need if you're starting from new) is to either have your
project in source control, or make a duplicate of your entire project's folder and rename it. This will
@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():