1
\$\begingroup\$

In my game I have a MoveComponent and a ClimbComponent.

Some characters can only move around on one level, others are able to climb to the next floor.

My intention is to have characters randomly be able to climb if the are about to bounce into a wall.

How would I manage this? Should the ClimbComponent be added dynamically and also be removed again, or should random characters always have the ClimbComponent and it would be activated and deactivated dynamically?

\$\endgroup\$
2
  • \$\begingroup\$ Can you clarify a bit your question? In the title you ask about one component triggering another, while in the description you ask about adding/removing vs enable/disable a component. \$\endgroup\$ Commented Feb 7, 2017 at 9:14
  • \$\begingroup\$ It's a design question: if an entity can potentially climb, should it have a "climb" component and the move component would send a message to it to make it start climbing, or should the "move" component add the "climb" component instead? \$\endgroup\$ Commented Feb 7, 2017 at 9:57

2 Answers 2

0
\$\begingroup\$

I would recommend you consolidate your two concepts into one.

Instead, I would consider a MovementComponent or better yet a ControllerComponent. This one component controls movement both on a single level and the act of being able to climb when appropriate.

Be mindful that you aren't creating components just to create components. There are cases where using a marker component makes sense but in a lot of cases, a simple boolean does the job well.

\$\endgroup\$
0
\$\begingroup\$

I don't think there's a clear winner between the 2 approaches you mention.
I'd probably go for a component always present on the entities that can be activated dynamically, and have some game logic component (a "higher level" one) that switches them on/off.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.