Moving a Player through pipe in ECS system

Started by
0 comments, last by wahlstra 5 years ago

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:
2019-03-23-MetalTubes.gif

Here is my current idea of how to implement this in ECS.

  1. Player enters the entrance of a Pipe
  2. Remove the PlayerControlledComponent to from the player entity
  3. Add PathFollowingComponent to the player (this will then trigger automatic movement through the pipe).
  4. While player is following path
    • Do things like
    • Update animation of pipe
    • Create hitbox that follows player in pipe....
  5. 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

This topic is closed to new replies.

Advertisement