classes/class_object #293
Replies: 4 comments 5 replies
-
There is as far as I can tell no example that shows how to use Connect() with my own parameters and flags. In fact, I don't think there's an example that shows how to use flags at all. |
Beta Was this translation helpful? Give feedback.
-
Requesting documentation and examples for overloading/shadowing new() on Object. Observations: extends Node
class Foo extends Object:
static func new():
var this = super()
return this
func _ready():
var __ = Foo.new()
> Function "new()" not found in base Object. Workaround is to reference Object directly ...
var this = Object.new() Casting up appears implicit ...
func _ready():
var __ = Foo.new()
print(str(__ is Foo))
> true |
Beta Was this translation helpful? Give feedback.
-
I notice that extends Node2D
@onready var icon: Sprite2D = %Icon
var source_code_a: String = """
extends Sprite2D
func _process(delta: float) -> void:
rotation_degrees -= 1
"""
var source_code_b: String = """
extends Sprite2D
func _process(delta: float) -> void:
rotation_degrees += 3
"""
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
_override_icon_script(source_code_a)
func _override_icon_script(source_code: String):
var script := GDScript.new()
script.set_source_code(source_code)
script.reload()
icon.set_script(script)
icon.set_process(true)
func _process(delta: float) -> void:
if Input.is_action_just_released("ui_left"):
_override_icon_script(source_code_a)
elif Input.is_action_just_released("ui_right"):
_override_icon_script(source_code_b)
|
Beta Was this translation helpful? Give feedback.
-
what is |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
classes/class_object
Inherited By: AudioServer, CameraServer, ClassDB, DisplayServer, EditorFileSystemDirectory, EditorInterface, EditorPaths, EditorSelection, EditorUndoRedoManager, EditorVCSInterface, Engine, EngineD...
https://docs.godotengine.org/en/stable/classes/class_object.html
Beta Was this translation helpful? Give feedback.
All reactions