All docs

Enemy Editor

Define enemy types (.venemy) — sprites, stats, AI behaviour, patrol routes, and optional state machines.

The Enemy Editor opens when you create or double-click a .venemy file. It defines everything about an enemy type: what it looks like, how it moves, and how the AI controls it. The compiler reads this file at build time and emits the corresponding ROM tables automatically.

Enemy Editor panel — header with behaviour badge, Actions, Stats, and Behaviour sections visible


Actions

Actions are the named behaviours an enemy can perform. Each action has a sprite and optional playback settings.

FieldDescription
NameIdentifier used in VPy code and state machine transitions (e.g. idle, walk, attack).
SpriteThe .vec or .vanim file to render while this action is active.
LoopRepeat the animation continuously while the enemy is in this action.
Typeanimation (default) or shoot — shoot spawns a projectile.

A new enemy file starts with idle and walk already created.

Actions section — idle and walk rows, walk row with a .vanim selected and Loop ticked


Stats

FieldRangeDescription
HP1–99Hits required to defeat the enemy.
Speed1–255Movement speed in Vectrex units per frame.
Action Duration1–9999Frames (@50 Hz) before the AI may switch actions.

Behavior

The Type dropdown selects the AI mode:

TypeColorDescription
patrolBlueFollows an explicit list of waypoints in order.
wanderPurpleAuto-patrols the walkable area on its platform. No waypoints needed — the compiler derives them from the Playground's walkable area paint.
chaseRedPursues the player when within Chase Range units.
fleeGreenRuns away from the player when within Chase Range.
staticGreyDoes not move.

Common options (patrol and wander):

OptionDescription
Mirror on turnFlip the sprite horizontally when the enemy reverses direction.
Default facingWhich direction the enemy faces at spawn (left or right).
Patrol actionWhich action name to play while moving (usually walk).

Behaviour section — Type set to wander, Mirror on turn checked, Patrol action set to walk


Patrol Waypoints

Only available when Type is set to patrol. Add explicit (x, y) waypoints — the enemy walks between them in sequence. You can also place and drag waypoints visually in the Playground editor.

Leave the list empty with wander type — the compiler generates the patrol route automatically from the walkable area.


State Machine

The optional State Machine lets you build more complex enemy logic: hurt reactions, attack patterns, death sequences.

Click Enable to activate the FSM. Each state has:

FieldDescription
NameState identifier (e.g. normal, hit, dying).
ActionWhich action to play while in this state.
Decay framesIf > 0, automatically transition to Decay to state after this many frames.
EventsNamed triggers (e.g. on_hit, on_player_near) → target state transitions.

The IDE generates VPy handler stubs for each event trigger so you can wire them up in code.

State machine section — two states, normal and hit, with a decay transition configured


File format

{
  "version": "1.0",
  "name": "crawler",
  "actions": [
    { "name": "idle", "sprite": "assets/vectors/enemy.vec",       "loop": true,  "type": "animation" },
    { "name": "walk", "sprite": "assets/animations/enemy_walk.vanim", "loop": true, "type": "animation" }
  ],
  "stats": { "hp": 1, "speed": 1, "action_duration": 60 },
  "behavior": {
    "type": "wander",
    "patrol": {
      "waypoints": [],
      "loop": true,
      "mirrorOnPatrol": true,
      "defaultFacing": "right",
      "patrolAction": "walk"
    },
    "respawn": false,
    "wave": 0
  }
}

In VPy code, spawn enemies and update them with:

SPAWN_ENEMIES("world_1")   # call once in main()
UPDATE_ENEMIES()            # call every frame in update()
DRAW_ENEMIES()              # call every frame in draw()