XMLGameEngine is a VGDL (video game description language) and an engine for running games completely contained within an XML file.
<collisions> says how an object touches, then its rules:
<collisions>
<type>pixel</type> <!-- optional: box (default) or pixel -->
<solid char="*" /> <!-- optional, pixel only: which bitmap characters touch -->
<collision edge="vertical"><bounce /></collision>
<collision class="bricks"><deflect>30</deflect></collision>
<collision object="paddle" side="bottom"> ... </collision>
</collisions>
In order: <enabled> (false turns it off), <lockstep>, <type>, <solid>s, a <hitbox>, then the rules. Only objects in play with collisions on take part.
edge="left", right, top, bottom, vertical (top and bottom), horizontal (left and right), all. Edges are checked by position, before the frame’s move.class="..." and/or object="..." (one object, a group, a copy’s piece), both meaning AND. A <collision> with neither is about anything. An edge rule with either stops the load.| Filter | Runs only |
|---|---|
side="top" (bottom, left, right, horizontal, vertical) |
when touched on that side of its own object: a ball falling onto a block is touched on its bottom |
sprite="cracked" (edges too) |
while its object shows that look, as the touch happened |
unless="logs" (edges too) |
when not also touching something of that class right now. Frogger’s river: <collision class="water" unless="logs"> |
through="floor" |
for a touch felt through something of that class; without it, only a direct touch |
<slower>N</slower>, <faster>N</faster> (first in the rule) |
while its speed is under N, or N or more, as the touch happened: a landing and a crash on one pad. Not on edges |
<condition>s, <all>, <any> (after those) |
while every one holds, written as a condition. One with no class= or object= is about the object itself. Not on edges yet |
<set> of x, a <shift>, a spawn). Being loaded or reset is not a move. An object mid-jump is in no pair.contactOf, play/geometry.h): the edge of each touched, the point, the way apart, where along each side, how deep, and when in the frame. Rules read it as side=, touch.*, <bounce> and <knock>.<type>pixel</type>. Swept as boxes first, then walked half a pixel at a time until a drawn pixel of one meets a drawn pixel of the other. Text and images cannot be pixel. The way apart is how what is drawn lies at the point (pixelContactAt), so a ball meets a drawn slope at its angle.<solid char="*" /> after <type>pixel</type>: only those characters of the bitmap touch (Q*bert’s cubes by their tops).<hitbox>: a <rectangle> or <circle> that touches other objects instead of the picture, then its <position> in the picture. The window’s edges, <land />, <stick /> and carrying still use the picture. Not with pixel.<hitbox>
<rectangle><width>12</width><height>6</height></rectangle>
<position><x>6</x><y>18</y></position>
</hitbox>
<lockstep>true</lockstep> in a group’s <collisions> makes each innermost group one block: its members never touch each other, a rule’s <move> moves them all, and one hitting a side with <bounce /> turns the whole block. Each cell is still swept on its own, so a bullet meets only the cells alive. This is the invaders’ march.
<knock /> in a rule about another object makes the two meet as things with weight:
<collision class="ball"><knock>0.3</knock></collision> <!-- on a flipper -->
<mass>es; across it each keeps its own, so a ball hit off centre goes off at an angle.<knock /> for one touch does nothing.<mass> is as heavy as can be: never moved, and its knock sends a thing off at up to twice its speed (Trick Shot’s cue tip).<bounce> up to 1 settles the same way; a bumper’s never does.<friction>, a thing that knocks or bounces off something with no mass loses speed along the surface. When it settles it comes to rest (still, not pulled) if what it lies on is still and either its pull cannot slide it, or it is wedged between two surfaces. It wakes when something moves it or its support moves.through="class" rules about the knocker. Mario’s head under a floor tile is a <knock>0</knock> that reaches the shellcreeper on top, whose <collision class="brother" through="floor"> flips it. One level only.