cross-posted from: https://programming.dev/post/1086370
This time on my arbitrary blog: Entity component systems.
Also, highlight.js should degrade more gracefully without JS activated than last time. Note that I can’t process syntax highlighting in my build step, because I don’t have a build step.
In this case, would the components be combined into a list? Basically you’d have a
BubbleComponent[]
attached to the entity instead of just aBubbleComponent
? Maybe I’m misunderstanding what the system is, isclick_handler
in the post a system, and if so, do systems only declare a single component of an entity as their input? From my experience, you often want to work with multiple components of the same entity in a system, for example:-- Mark characters with 0 or less life as dead function mark_dead(character: BoundaryComponent) { with character as movement: MovementComponent { character.x += movement.velocity.x * delta_secs; character.y += movement.velocity.y * delta_secs; } }
Would there be a simpler way to query these components in the system, and what if I wanted to query for both
BoundaryComponent
andBubbleComponent
, what would that look like?