Design Pattern for colliding objects

Godot Version

4.2.1

Question

Imagine you have bullets, bombExplosion, flameShot, LaserShot, etc. - all of these are damaging projectiles and back then in another game engine, I have them “inherit” an abstract class so I could call the logic in each method of these objects below when I check for collision. In Godot 4, how to do this?

you can make a script and add class_name BulletBase and then instead of do “extends Node2D” or whatever you can do “extends BulletBase” and then you can use the logic in that script

GDScript style guide — Godot Engine (stable) documentation in English

1 Like