1st Person - Shooter

This brain adds mechanics for a First-Person View. Camera turns around the character. The default accuracy is not precise (based on a random vector cone). Camera turn speed can be changed from the advanced movement menu in prop edit.

Kode:

[WHEN] "once" [DO] "team", "equals", "team 1"

[WHEN] [DO] "1st person camera"

[WHEN] [DO] "display", "Crosshair", "screen center"

[WHEN] [DO] "show meter", "health", "max", "max health", "screen top left"

[WHEN] "left stick" [DO] "move"

[WHEN] "A", "pressed" [DO] "jump"

[WHEN] "X", "or", "right trigger", "or", "left mouse button"

> [WHEN] [DO] "shoot", "Crossbow Bolt", "at speed", "50", "launch frequency", "20", "lifetime", "1.5", "in direction", "random vector", "cone", "direction", "camera forward", "angle", "1.5"

[WHEN] "detect", "interactable", "objects in front"

> [WHEN] [DO] "highlight", "it", "yellow"

> [WHEN] "is using keyboard/mouse" [DO] "display", "middle mouse button", "above", "it"

> [WHEN] "is using controller", "or", "is using touch" [DO] "display", "B", "above", "it"

> [WHEN] "B", "pressed" [DO] "interact"