logo

Install with the CLI:

bjs download Enemy

Enemy

Marks an entity as hostile. No data, no System — the whole component is the classification.

What it does

Enemy is a marker: a component class with no fields. Attaching it says one thing about an entity, that it is hostile, and every genre agrees on that much. A chase speed, a contact radius or a point value belongs to one subgenre's AI, so none of them live here.

Being a class rather than a string tag is what earns it a place. Code asks:

TypeScript
const hostile = entity.get(EnemyComponent);   // the component, or undefined

which cannot be typo'd the way entity.hasTag('enmey') can, and which the marketplace component graph can actually see.

Use it in a scene

A scene is just data — a list of entities, each with its components. At startup the SceneLoader turns this JSON into a live world; edit the file and reload to rebuild it.

Fastest path

bjs download scene Enemy

Pulls this exact scene into your project and runs it — no copy-paste. Add --all to grab the components and assets it needs too.

Or build it from scratch with the bjs CLI:

  1. 1Scaffold a project
    npm create @babylonjsmarket/arcade@latest my-game

    World, renderer, and dev server — ready to run.

  2. 2Install dependencies
    cd my-game && npm install
  3. 3Add Enemy
    bjs download Enemy

    Copies its source into src/ so the scene resolves.

    First time? Run bjs login once.

  4. 4Paste the scene into src/scenes/arcade-room.ts and run
    npm run dev

    SceneLoader builds the world from the JSON; reload to rebuild.

JSON
{
  "Enemy1": {
    "tags": ["enemy"],
    "components": {
      "Transform6DOF": { "x": 26, "y": 6, "z": 62 },
      "Enemy": {}
    }
  }
}

Props

None. "Enemy": {} is the whole declaration.

Events

Emits nothing and listens for nothing.

Dependencies

None.

Notes

  • There is no EnemySystem. A scene loader that finds no ${Name}System simply attaches the data, which is right for a marker: three unrelated consumers read it (targeting, impact, scoring) and none of them owns it.
  • Looking for the chase-and-bump swarm AI? That is TwinStickEnemy — it kept the behaviour and gave the bare name back to the marker.

More like this

AIGoalSeek
AIKick
AIZone
AiDriver
AiPilot
BallPossession
BallPursuit
BallReset
ChaseCameraTarget
EnemySpawner
FreighterChain
Goal
LineOfSight
PokerAI
PokerAIBill
PokerAICali
PokerAIRandy
PokerAIShark
PokerAISurge
PokerAITilt
RespawnTimer
RoundReset
Scoreboard
SoccerDirector
TrafficConvoy
TwinStickEnemy
WaveDirector

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search