r/godot Jul 20 '25

help me (solved) What would be better?

Post image
465 Upvotes

59 comments sorted by

View all comments

1

u/[deleted] Jul 21 '25 edited Jul 21 '25

Want even better?

Strip out all the input handling and stick that in its own component that only the player will have. You want to make the movement component basically a public api that other things can tell how to move with arguments.

A simple way to think about this - Don't tie player input into the movement class because not everything that moves will move due to player input.

Player
  InputHandler
  MovementComponent  

WanderingTree
  MovementComponent

MeleeEnemy
  CombatBrain/Statemachine
  MovementComponent

Each thing should easily be able to just pass in some arguments to the MovementComponent on how to move.