Modular Powerups: Polymorphism in GDScript

Опубликовано: 17 Август 2026
на канале: Paul Gestwicki
1,694
76

This video demonstrates how subtype polymorphism can be used in Godot Engine in order to create modular powerups. That is, we can create different abilities for the player by putting them into separate scripts and dynamically attach these scripts to the player.

A few ideas that show up in this video are:
Sharing a script between multiple scenes
Using class_name in order to benefit from type hints
Instantiating non-scene scripts at runtime
Using setget with a custom accessor
How tau can be more convenient than pi