Scripting API
Scripting API
SpriteSlice
Record struct in Abyss.Core, from Abyss.Core.
One slice of an image cut into sprites: what finds it, what it is called, its rectangle of the image in pixels from its top left corner, its pivot and its border.
public readonly record struct SpriteSliceConstructors
SpriteSlice
public SpriteSlice(ulong Id, string Name, int X, int Y, int Width, int Height, Vector2 Pivot, Vector4 Border)One slice of an image cut into sprites: what finds it, what it is called, its rectangle of the image in pixels from its top left corner, its pivot and its border.
Parameters
Id: What finds it whatever it is called and wherever it is in the list; never zero.Name: What it is called.X: Its left edge, in the image's pixels from its left.Y: Its top edge, in pixels from the image's top.Width: How wide it is.Height: How tall.Pivot: What it turns about and is placed by, as a sprite's Pivot says one: zero at its middle, a half at an edge, up being up.Border: How far in from each side a Sliced sprite's corners reach, in pixels: left, top, right, bottom.
Properties
Id
public ulong Id { get; init; }What finds it whatever it is called and wherever it is in the list; never zero.
Name
public string Name { get; init; }What it is called.
X
public int X { get; init; }Its left edge, in the image's pixels from its left.
Y
public int Y { get; init; }Its top edge, in pixels from the image's top.
Width
public int Width { get; init; }How wide it is.
Height
public int Height { get; init; }How tall.
Pivot
public Vector2 Pivot { get; init; }What it turns about and is placed by, as a sprite's Pivot says one: zero at its middle, a half at an edge, up being up.
Border
public Vector4 Border { get; init; }How far in from each side a Sliced sprite's corners reach, in pixels: left, top, right, bottom.
Collision
public TileCollision Collision { get; init; }How Physics 2D meets a tile of it, where a Tilemap draws it: solid unless said otherwise.
Shape
public TileShape Shape { get; init; }What of its cell a tile of it fills, where a Tilemap draws it: all of it unless said otherwise.
IdText
public string IdText { get; }Its identity as a scene and a sidecar write it: sixteen hexadecimal digits.
Methods
Holds
public bool Holds(int x, int y)Whether a point of the image, in its pixels, is in it.
Parameters
xy
NewId
public static ulong NewId()A new identity no slice is likely ever to have had: random, and never zero.
ParseId
public static ulong? ParseId(string? text)The identity sixteen hexadecimal digits write, or null where they do not, or write zero.
Parameters
text
