From what I worked out while developing Superluminal...
FTL uses positioning system with X axis increasing rightwards, and Y axis increasing downwards:
- X axis: positive - right, negative - left
- Y axis: positive - down, negative - up
As a consequence, objects are anchored in their top left corner, ie. object placed at point (0, 0) with size (width, height) will have the other three corners at points (width, 0), (0, height), (width, height).
Ship's origin point - Po
- FTL has a predetermined, hardcoded common point (separate for player/enemy ships) that serves as origin for further translations.
- X_OFFSET translates the point by #*35 pixels in X axis
- Y_OFFSET translates the point by #*35 pixels in Y axis
- HORIZONTAL translates the point by # pixels, X axis
- VERTICAL translates the point by # pixels, Y axis
Let's call the resulting point
Po
Rooms and doors are then placed relative to
Po.
Images' origin point - Pi
- Ship images use Po as origin for further translations
- <img>'s x= attribute translates the point by # pixels, X axis
- <img>'s y= attribute translates the point by # pixels, Y axis
Let's call the resulting point
Pi.
Ship image properties:
- Base, floor, cloak, gibs are all placed at Pi
[cloak having x - 10, y - 10]
- <img>'s w= and h= attributes determine the size of base, floor and cloak
[cloak having width + 20, height + 20]
- Gibs are further translated from Pi on an individual basis via <gib#> tags' <x> and <y> tags
Shield image origin point - Ps
I explained that not so long ago
here, but I guess it's pretty confusing, maybe this image will clear it up:
Red rectangles - rooms
Blue rectangle - bounding rectangle - smallest rect containing all rooms
Ps is placed at the intersection of the bounding rectangle's diagonals. It
doesn't have to line up with the room grid (could be in the middle of a room, for example)
Ellipse - shield image and collision perimeter
Code: Select all
ELLIPSE
350 = semi-major axis in elliptical equation - a
220 = semi-minor axis in elliptical equation - b
-30 = x offset
0 = y offset
The ellipse is then calculated using the following equation
Ps,x is the x component of
Ps
Ps,y is the y component of
Ps
What this basically means, is an ellipse with width = 2*
a and height = 2*
b, centered at
Ps offset by the
x and
y offset values.
The resulting ellipse is the projectile collision perimiter, defense drone orbit, and shield.
For whatever reason, player ships' shield image
is not affected by the ellipse's width and height, only the offset values.
However, enemy ships' shield image is resized to match the ellipse exactly.
...soo yeah, that about covers it, I guess
