This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## @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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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() }) | |
| ] | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(): |
NewerOlder