Hi, I keep running into this problem when working in Godot, where I want to use class-based inheritance to handle different types of behavior for a character or enemy (whether thats different control schemes for a player, or different AI patterns for an enemy). In my mind, the implementation should be something like this for the AI example:
ai_controller.gd
func get_move():
pass
func get_attack():
pass
passive_ai.gd
extends ai_controller
func get_move():
//move passively
func get_attack():
//don't attack
sheep.gd
export(int) HEALTH
export(ai_controller) AI_CONTROLLER
func _process(delta):
AI_CONTROLLER.get_move()
AI_CONTROLLER.get_attack()
Having said all this, I have two questions:
1) How can I implement something like this in gdscript? The end-goal would be to be able to drag and drop 'ai behaviors' into various enemies.
2) Is this the 'Godot way' of implementing this type of behavior? I can't tell if this is the wrong way to approach this type of problem when working in Godot, so even if this type of implementation described above is possible, I'd like to know how Godot is designed to tackle this kind of problem. Thanks!