SpriteGroup<T> class

Several Sprites laid end to end, addressed as one run of rows.

final slime = SpriteGroup([
  SpriteSheet('assets/idle.png', .all(56), fps: 16, rows: [.new(key: 'idle')]),
  SpriteSheet('assets/jump.png', .all(56), fps: 24, rows: [.new(key: 'jump')]),
]);

node.play(key: 'jump');

Rows are numbered straight through, so a part contributes as many as it holds and the next one carries on where it left off. Parts answer for their own rows, so each brings its own image, frame size, rates and looping. Anything implementing Sprite can be one of them.

Names come from the parts, never from here: rowOf asks each of them in turn and shifts the answer by the rows before it.

Inheritance

Constructors

SpriteGroup(Iterable<Sprite<T>> parts)

Properties

hashCode int
The hash code for this object.
no setterinherited
parts List<Sprite<T>>
What this draws, in the order their rows are numbered.
final
rows int
How many rows of frames this holds.
latefinaloverride-getter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

duration(int row, int index) double
How long frame index of row is held, in seconds.
override
frames(int row) int
How many frames row plays.
override
image(int row) Image
The image row is drawn from.
override
loops(int row) bool
Whether row starts over after its last frame.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
rect(int row, int index) Rect
Where frame index of row sits in image.
override
reload() SpriteGroup<T>
Re-resolves this sprite against Ignis.cache.
override
rowOf(T key) int?
The row key names, or null where nothing here answers to it.
override
size(int row) Vector2
The size of one frame of row, which a SpriteNode takes as its own.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited