Skip to main content

Components overview

An overview over all components shipped with the ScrewBox ECS Also have a look at the standalone systems. Adding a Component to an Entity will automatically add the described behaviour if the corresponding EntitySystem was added to the Environment. See Prepacked systems and components for more information.

tip

To use all components out of the box use engine.enableAllFeatures(). But this will come with some unnecessary systems that will consume a neglectable time. So if you struggle with fps it might be a good idea to avoid unnecessary systems. Otherwise this is the recommended way to go.

Common Components

ComponentDescription
TransformComponentMost common component. Specifies size and position of the entity within the game world.

AI components

To use these components call environment.enableAi() first.

ComponentDescription
PatrolMovementComponentApplies a patrolling movement pattern.
PathMovementComponentMoves an entity along a Path.
TargetMovementComponentMoves the entity towards the specified position. Does not avoid obstacles.
TargetLockComponentRotates the sprites of the RenderComponent towards the specified target entity.

Control components

To use these components call environment.enableControls() first.

ComponentDescription
LeftRightControlComponentLet the entity move left and right on key press.
JumpControlComponentLet the entity do a jump on key press.
SuspendJumpControlComponentEnforce ground contact for jumping.

Tweening components

To use these components call environment.enableTweening() first.

ComponentDescription
TweenComponentAdds tweening to an entity. Required for all tween related components.
TweenPositionComponentAdds tweening movement from one position to another.
TweenOrbitPositionComponentAdds an orbiting movement around a central position.
TweenDestroyComponentRemoves the entity after the tween is finished.
TweenScaleComponentTweens the scale of an Sprite used in the RenderComponent.
TweenOpacityComponentTweens the opacity of an Sprite used in the RenderComponent.
TweenSpinComponentTweens the spin Sprite used in the RenderComponent.
TweenLightComponentTweens the opacity of all light related components.

Rendering components

To use these components call environment.enableRendering() first.

ComponentDescription
RenderComponentRenders a Sprite at the entity position.
ReflectionComponentReflects sprites at the entity bounds. Also supports water animations.
MovementRotationComponentRotates Sprites in direction of movement.
FixedRotationComponentContinuously updates the rendered Sprite rotation.
FlipSpriteComponentFlips the Sprite horizontally when the entity moves to the left.
FixedSpinComponentContinuously updates the rendered Sprite spin.
CameraTargetComponentMoves the camera towards the entity.
CameraBoundsComponentSets the bounds in which the camera will be moved when using CameraTargetComponent.

Logic components

To use these components call environment.enableLogic() first.

ComponentDescription
TriggerAreaComponentDetects when the Entity collides with another matching the specified Archetype.
StateComponentUsed to add a simple state machine to the entity.

Physics components

To use these components call environment.enablePhysics() first.

ComponentDescription
PhysicsComponentAdds physics behaviour to an entity. Applies friction and movement and avoids collisions.
CollisionSensorComponentDetects collisions with physics.
ColliderComponentPrevents physic entities from intersecting.
AttachmentComponentAttaches an entity to another.
CollisionDetailsComponentCollects detailed information on collisions detected by CollisionSensorComponent.
StaticColliderComponentOptimizes performance when added to entities with ColliderComponent that will not move.
AirFrictionComponentSlows down an entity even when not collided with anything.
GravityComponentA singleton component that specifies gravity value for the game world.
CursorAttachmentComponentAttaches the entity to the mouse cursor.
MagnetComponentAttracts or repels physic entities.
ChaoticMovementComponentAdds a random chaotic movement to physics entities.
PhysicsGridConfigurationComponentSingleton component that configures the physics grid used for pathfinding.
PhysicsGridObstacleComponentMarks entity as obstacle that is marked in the physics grid.

Audio components

To use these components call environment.enableAudio() first.

ComponentDescription
SoundComponentAdds continuous sound playback to the entity position. See Audio.

Light components

To use these components call environment.enableLight() first.

ComponentDescription
ConeLightComponentAdds a cone light at the entity position.
PointLightComponentAdds a point light at the entity position.
SpotLightComponentAdds a spot light at the entity position.
GlowComponentAdds a glow at the entity position.
OrthographicWallComponentMarks entity as orthographic wall that will only be illuminated from below and cast shadows.
ShadowCasterComponentAdds shadow casting from the entity bounds.
StaticShadowCasterComponentOptimizes performance by combining shadow caster components that won't move.

Particle components

To use these components call environment.enableParticles() first.

ComponentDescription
ParticleComponentMarks an entity as particle. Will be automatically added to all particles.
ParticleEmitterComponentAdds particle emission to an entity.
ParticleInteractionComponentTransmits entity motion on other entities that have ParticleComponent and are nearby.
ParticleBurstComponentUsed to automatically shutdown particle emitters after a timeout.