Skip to main content

Module threat

Module threat 

Source
Expand description

The threat arrows, as every grid skin draws them (game ticket 0448): a slim straight arrow from each enemy that could attack a tile to that tile, and a ! above each of those enemies. Over units and terrain, so never hidden. Worked out from the skin’s tile size, in the art’s own pixels.

An arrow is a 1-pixel line from the enemy’s tile (its middle, or its edge for a skin whose units are letters: Start) to just short of the middle of the tile it threatens, ending in two barbs, with a 1-pixel dark edge all round. A line at any angle is a row of short rectangles, one per step across it. An enemy outside the view has its arrow cut at the view’s edge and no mark.

Structs§

Colors
The colours of the arrows and marks.

Enums§

Start
Where on its enemy’s tile an arrow starts.

Constants§

BARB_LEN
How long each of an arrowhead’s two barbs is, in pixels. Tunable.
MARK_ABOVE
Pixels between the mark’s lowest pixel and the tile’s top edge, so that it clears the head of the unit standing there (Nick: lower, “it covers the enemy’s head and looks weird”). Tunable.
MARK_BAR_H
The height of the mark’s bar, of the gap under it and of its dot.
MARK_H
The mark’s height, bar to dot.
MARK_W
The mark’s width, in pixels.
TIP_SHORT
How far short of the tile’s middle an arrow’s tip stops, in pixels. Tunable.

Functions§

paint
Paints scene’s threat arrows and marks, if it has any, on grid, in colors (Looks::threat), each arrow from its enemy’s tile at start.
threat_overlays
The overlays drawing threat on grid, all Over the glyphs: every arrow’s dark edge, then the arrows (each from its enemy’s tile at start); then every mark’s dark edge and the marks. Clipped to the tiles of grid. On a zoomed grid every pixel is a square of the zoom’s.