Staticadjacent4Generates a list of XY to add to a given coordinate in order to get all adjacent pixels in 4 directions (left/up/right/down).
Staticadjacent8Generates a list of XY to add to a given coordinate in order to get all adjacent pixels in 8 directions.
StaticassertThis function is meant to be used in a last branch of if - else if - … - else
chain or in default of switch - case - case - …. Let's imagine there is
a union type of which we check all possible cases. Someday we add one more
type to the union, but we forget to extend our switch by that one more case.
Thanks to assertUnreachable(theValueOfThatUnionType) the TypeScript checker
will inform us about such mistake.
a value which we expect to be of type never
StaticbooleanHow often to change the returned value
Optionalopts: { OptionalonBy default the method doesn't progress during the game pause.
But with this param set to "ignore" we can change that behaviour.
Either true or false, which changes every n frames
StaticclampStaticdrawSimilar to BeetPxDraw.text, but with a second color specified, to be used as an outline.
Optionalopts: { OptionalcenterOptionalscaleStaticidentityStaticlerpPicks a number between a and b which is in a "distance" between them as specified by t.
Specifically: lerp(a,b,0) === a and lerp(a,b,1) === b.
With opts: { clamp: true }, the resulting value cannot is always within bounds of a and b, even if t is below 0 or above 1.
Optionalopts: { Optionalclamp?: booleanStaticmodStaticnoopStaticrandPicks a random value from a given range.
Picks a random vector from a given range.
StaticrandPicks a random integer value from a given range.
Picks a random integer vector from a given range.
StaticrandStaticrangeStaticrepeatStaticthrowStatictrigStatictrigStatictrig
One of 3 main API entry points. This one provides you with the useful utils.
Example