Jump to content
  • Advertisement
wahlstra

Moving a Player through pipe in ECS system

Recommended Posts

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

Share this post


Link to post
Share on other sites
Advertisement

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!