getTile method
Implementation
Tile getTile(BonfireGameInterface gameRef) {
if (animation == null) {
if (collisions?.isNotEmpty == true) {
final tile = TileWithCollision.fromSprite(
sprite!.getSprite(),
Vector2(
x,
y,
),
offsetX: offsetX,
offsetY: offsetY,
collisions: collisions,
width: width,
height: height,
type: type,
properties: properties,
);
tile.angle = angle;
tile.isFlipHorizontal = isFlipHorizontal;
tile.isFlipVertical = isFlipVertical;
tile.gameRef = gameRef;
tile.id = id;
return tile;
} else {
final tile = Tile.fromSprite(
sprite!.getSprite(),
Vector2(
x,
y,
),
offsetX: offsetX,
offsetY: offsetY,
width: width,
height: height,
type: type,
properties: properties,
);
tile.angle = angle;
tile.isFlipHorizontal = isFlipHorizontal;
tile.isFlipVertical = isFlipVertical;
tile.gameRef = gameRef;
tile.id = id;
return tile;
}
} else {
if (collisions?.isNotEmpty == true) {
ControlledUpdateAnimation animationControlled =
animation!.getSpriteControlledAnimation();
final tile = TileWithCollision.withAnimation(
animationControlled,
Vector2(
x,
y,
),
offsetX: offsetX,
offsetY: offsetY,
collisions: collisions,
width: width,
height: height,
type: type,
properties: properties,
);
tile.angle = angle;
tile.isFlipHorizontal = isFlipHorizontal;
tile.isFlipVertical = isFlipVertical;
tile.gameRef = gameRef;
tile.id = id;
return tile;
} else {
ControlledUpdateAnimation animationControlled =
animation!.getSpriteControlledAnimation();
final tile = Tile.fromAnimation(
animationControlled,
Vector2(
x,
y,
),
offsetX: offsetX,
offsetY: offsetY,
width: width,
height: height,
type: type,
properties: properties,
);
tile.angle = angle;
tile.isFlipHorizontal = isFlipHorizontal;
tile.isFlipVertical = isFlipVertical;
tile.gameRef = gameRef;
tile.id = id;
return tile;
}
}
}