Skip to main content

Components

These are the data components you will use most often from gameplay code. They are intentionally small and data-oriented so the systems can read exactly what they need.

Spatial

Transform

Transform defines where an entity is and how it is drawn.

FieldDefaultUse
Position(0, 0)world position
Scale(1, 1)per-axis scale
Rotation0rotation in degrees
Pivot(0, 0)local rotation and scale pivot

GetMatrix()

Builds the full model matrix using:

  1. position
  2. pivot
  3. rotation
  4. scale
  5. inverse pivot

Example

player.Transform().SetPivot(Vec2(16.0f, 16.0f));
player.Transform().Rotate(90.0f);
tip

Pivot is useful when you want to rotate around the center of a sprite or around a character's feet.

Visual

SpriteRenderer

SpriteRenderer controls the visual part of an entity.

FieldDefaultUse
TextureNameemptylogical texture name
ColorwhiteRGBA tint
Visibletruedraw or not
RenderOrder0layer order
SourceRect0,0,0,0texture region in pixels
FlipXfalsehorizontal mirroring
FlipYfalsevertical mirroring

Notes

  • if TextureName is empty, the engine uses the fallback texture
  • if SourceRect is empty, the full texture is drawn
  • a lower RenderOrder is drawn first

Example

sprite.Sprite().SetColor(Colors::Blue());
sprite.Sprite().FlipX(true);
sprite.Sprite().SetRenderOrder(50);

Physics

Collider

Collider defines an axis-aligned box for physics and triggers.

FieldDefaultUse
Size(1, 1)collider size
Offset(0, 0)offset relative to the transform
IsTriggerfalsesensor without physical blocking
callbacksemptytrigger events

Important

Collider is axis-aligned.

  • it does not rotate with Transform::Rotation
  • it does not scale with Transform::Scale
  • it is computed from Transform::Position + Offset and Size

Example

box.Collider().SetSize(Vec2(32.0f, 48.0f));
box.Collider().SetOffset(Vec2(0.0f, 8.0f));
box.Trigger().SetTrigger(true);

Rigidbody

Rigidbody controls the dynamic part of physics.

FieldDefaultUse
Velocity(0, 0)current speed
IsStaticfalsewhether the body moves through physics
UseGravityfalsewhether global gravity affects it
GravityScale25.0fgravity multiplier

Example

player.Rigidbody().SetUseGravity(true);
player.Rigidbody().SetVelocity(Vec2(180.0f, 0.0f));
note

The engine's collisions are AABB based. If you need real rotating physics or complex colliders, the current public API does not expose them.

Animation

AnimationClip

AnimationClip describes how to read frames from a spritesheet.

FieldDefaultUse
FrameSize(0, 0)size of each frame
FrameCount0total number of frames
FramesPerRow0horizontal layout
FPS12.0fplayback speed
Looptruewhether it loops
StartFrame0base frame inside the spritesheet

Animator

Animator stores the playback state and the clip map.

FieldDefaultUse
Clipsemptyclip map by name
CurrentClipemptyactive clip
Playingtruewhether it advances
CurrentFrame0current frame
Accumulator0.0ftime accumulated toward the next frame

Behavior

  • if FramesPerRow is 0, the system uses 1
  • if FrameCount <= 0, the clip does not advance
  • if FPS <= 0, the clip stays on the current frame

Example

AnimationClip run(iVec2(32, 32), 6, 3, 10.0f, true, 0);

Particles

Particle

Particle stores the state of a live particle.

FieldUse
Velocitycurrent velocity
Lifetimetotal lifetime
Agetime already lived
StartColor / EndColorcolor interpolation
StartScale / EndScalescale interpolation
GravityScaleper-particle gravity

ParticleEmitter

ParticleEmitter defines how particles are spawned.

FieldDefaultUse
Activetruewhether it can emit
Loopfalsewhether it auto-emits cyclically
AutoEmitfalsewhether it emits over time
OneShotfalsewhether it destroys itself after spawning
BurstCount8particles per burst
EmitRate0.0fbursts per second
Lifetime0.75flifetime of each particle
Speed80.0fbase speed
SpeedVariation20.0frandom variation
Spread180.0fangular spread
RenderOrder0draw layer

Example

ParticleEmitter emitter;
emitter.BurstCount = 12;
emitter.AutoEmit = true;
emitter.EmitRate = 4.0f;

OneShot is useful for one-off effects like explosions or hit sparks, where the emitter should clean itself up after the spawn cycle finishes.