Hi!
I'm new to the GameDev forums, so I hope I am asking in the right place.
I am developing a 2D platformer and ECS system for it in Go, and I am unsure how to implement the following in an ECS system. What I want to do is have the player character enter a pipe at one point, get automatically moved through the pipe (player has no control), and exit at the other end.
Here is an example from Leilani's Island:
Here is my current idea of how to implement this in ECS.
- Player enters the entrance of a Pipe
- Remove the PlayerControlledComponent to from the player entity
- Add PathFollowingComponent to the player (this will then trigger automatic movement through the pipe).
-
While player is following path
- Do things like
- Update animation of pipe
- Create hitbox that follows player in pipe....
- Once the path has been followed to the end, Add (return) PlayerControlledComponent to player entity
Is this a decent approach? A few other approaches could be to add a flag on the PlayerControlledComponent that disables it.
Best regards,
Magnus