Phazorknight / Cogito

Immersive Sim Template Project for GODOT 4
MIT License
902 stars 101 forks source link

Break player down into components #49

Open ac-arcana opened 8 months ago

ac-arcana commented 8 months ago

The player class is pretty large, and includes a lot of concerns. Perhaps player movement, player look, and damage receiver could all be separate components.

Phazorknight commented 8 months ago

Yup, definitely a goal of mine to chip away into improving how this is currently set up.

ac-arcana commented 7 months ago

Class names on player and any components that are broken off from it too, please.

aronand commented 5 months ago

I've had a look at the code and at least two things that could be done come to mind:

  1. Separate attribute management to its own node
  2. Implement a state machine to handle movement

Out of these two, the latter would definitely have a bigger impact on the code.

The first one might be more complex than initially seems. I quickly gave it a try some days ago, but recall running into issues with some level of coupling when trying to move attributes under this new node. Initially remembered it being due to attributes being coupled to the player, but that actually isn't the case now that I checked the code.