Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Bartosz |
I’m trying to recreate in Godot my workflow from unity. I’m used to mixin-like reuse of components e.g my characters have abilities that correspond to simple physical action e.g. move, jump, fly, swim, grab…
Each of that abilities operates on characters own rigid_body
and can be combine with any other ability without coding to create some more complex behavior e.g. monster + move + jump + detect_obstacle = monster_that_can_jump_over_pits
I’m new to Godot so I hacked this solution:
monster
|-- rigid_body
|-- move
|-- jump
|-- detect_obstacle
where rigid_body
is actual RigidBody2D
of monster and move,jump,detect_obstacle
are empty RigidBody2D
with script attached to them. Inside of scripts I use _integrate_forces
.
Is it correct approach to combine/mix behaviors in Godot without coding or is there a better way?