Skip to content

Stealth: guards and alert ​

For a game about crossing without being seen the guard must really see: walls have to block the view and it must not catch you instantly, but gradually. That is the advanced vision of a placed character.

Turn it on ​

In the inspector of a placed character, Edit the behavior → Guard → Guard: advanced vision (the cone shows on the window's map). It needs some behavior (patrol, wander or repeat an animation; for a guard that does not move, “Repeat an animation” with “Idle”).

SettingWhat it does
RangeHow far it sees, in scene pixels (default 260). Scaled by perspective.
Cone angleTotal opening, in degrees (default 110). It turns with the guard.
Obstacles block the viewThe scene's painted obstacles cut the line of sight. An object with an automatic footprint does not.
AttentionHow fast it notices: slow, normal or fast. It notices sooner up close than far away.
If it loses sight of youGoes back to its round, or goes looking for you: walks to where it last saw you, waits a few seconds and goes back to its business.

The canvas draws each guard's cone (yellow, dashed) so you can see what it covers without playing.

Without it, nothing changes

Classic vision (a 110° cone through walls, “sees you” instantly) is unchanged: projects that already use “When X sees the player…” work as before.

The “Behavior” window of a guard with advanced vision: the vision cone on the scene map and its settings

Calm, suspicion and alert ​

While it sees you, suspicion rises; when you are out of sight, it falls. Three states:

  1. Calm: keeps its round.
  2. Suspicious: it saw you for a moment. It stands still looking at you.
  3. On alert: it has you located. It stays on alert even if it loses you for a moment; if it loses you completely, it does what you chose (back to its round or search).

Logic blocks (scene actions, conditions and events):

  • When ‹character› becomes ‹calm / suspicious / on alert› (event).
  • if ‹character› is ‹…› (condition).
  • Leave ‹character› ‹…› (action): for example, calm it down after catching you.

On seeing you (no scripts) ​

The usual needs no scripts. In the placed character's properties, Edit the behavior → Guard → On seeing you:

  • When suspicious, says: a line when it starts to suspect (empty: says nothing).

  • When catching you, says: the line when it becomes on alert.

  • And then:

    • Nothing else: it stays on alert and a script decides.
    • You go back to this scene's entrance.
    • You go to another scene: for example, the jail, with the entrance you choose.
    • Game over: with the message you write. With Offer «Retry from just before», the end screen lets the player go back to the last checkpoint: when entering the scene, or wherever the Save a checkpoint block sets it (Rewind).
    • A script runs: one of yours or + New script…, which creates it and opens it in Logic.

    Going back to the entrance or to another scene calms the guard down.

When … becomes … scripts run as well, for whatever you want to add (losing an item, changing a variable…). Test walkthroughs and the puzzle checker understand “On seeing you” just like a script: if being caught takes you to the jail, the jail counts as reachable. The script or the jail chosen in “On seeing you” show it in their Used in (“Courtyard › Guard (character) · On seeing you”), and deleting them warns you first.

The “Guard with a round” template ​

In the scene card → Minigames → 🛡️ Guard with a round (stealth). It creates a guard that patrols between two new points (Round … A and B) with advanced vision, a hiding place (an obstacle next to the route) and its On seeing you already filled in: when suspicious it says “Who goes there?” and when it catches you it says “Halt!” and sends you back to the scene's entrance. Change it in its properties, without scripts: another line, the jail, game over or a script of your own. (Before version 0.44 the template created two scripts, “Guardia: sospecha” and “Guardia: alerta”, which still work.)

The guard has no drawing yet (Puzzles → Art to do); also draw something visible over the hiding place.

Testing it ​

The simulator does not walk

Test walkthroughs and Find a solution do not move the character around the scene, so they do not prove you can get past without being seen. What they do test is the alert logic: a step “Guardia becomes on alert” runs its scripts and its “On seeing you” and checks what happens. Find a solution tries that step as one more action. Really crossing is tested by playing.

Example test walkthrough:

Guard becomes suspicious
Guard becomes on alert

With the AI agent ​

The agent has add_guard_post (the template) and set_npc_behavior with vision, vision_range, vision_angle, vision_blocked, attention, on_lost and search_seconds, plus “On seeing you”: on_suspicion_say, on_caught_say, on_caught (none, entrance, scene, game_over, script), on_caught_scene, on_caught_entrance, on_caught_message and on_caught_script. read_scene shows it as on_seeing_you.