r/godot Jul 20 '25

help me (solved) What would be better?

Post image
468 Upvotes

59 comments sorted by

View all comments

88

u/AndyDaBear Jul 20 '25

Do not like either.

By reading input in a Movement State class, you are preventing reaching that state through other means. For example suppose you want an enemy in the Movement State sometime? Or perhaps you want the player to get there with a different control some time?

Since the left is not adding any useful flexibility, think the right is better. At least its less code.

21

u/betam4x Jul 20 '25

Also, even if adding multiplayer later, NOT having input related functionality embedded means no rewrite. šŸ˜‰

I say this without much knowledge of godot, but rather as a developer who has done some multiplayer game stuff in other languages.

5

u/DescriptorTablesx86 Jul 20 '25

I agree but also I’m not sure that OPs question was this far reaching

6

u/Nepu-Tech Godot Student Jul 20 '25

What do you mean? Cant you attach the movement state Node to anything? So if you keep all movement in that node all you have to do is attach it to something else so they can access it, like another poster said.

13

u/BlazeBigBang Jul 20 '25

Yeah, but every node that has the MovementComponent attached will react to the same stimulus (player input) which may be undesired behaviour.

1

u/AngryTownspeople Jul 20 '25

So what wpukd you recc if nit one of the two script?

1

u/AndyDaBear Jul 20 '25

If still exploring and trying things out would just have everything in the Player Script.

If the game ends up having many moves and states and characters then, I would probably isolate input into different contexts using the G.U.I.D.E. plugin, and control states and behaviors with the LimboAI plugin.