Ctrl+K

SpriteComponent

Declaration

public class Strawberry.Components.SpriteComponent

The sprite component is used to render a single sprite on the screen.

Inherits: Strawberry.Core.BaseComponent

Constructors

SpriteComponent

void SpriteComponent()

Properties

Sprite

Gets or sets the sprite to render on the screen. If null, no image will be rendered.

Sprite Sprite { get set }

Layer

Gets or sets the layer on which the sprite will be rendered.

SpriteLayer Layer { get set }

Transform

Gets the transform of the owner.

TransformComponent Transform { get }

ImageSpeed

Gets or sets the speed of playing animations (1 = a complete cycle per second). Default is 1.

float ImageSpeed { get set }

ImageCount

Gets the number of images in the sprite.

float ImageCount { get }

Loop

Gets or sets whether the sprite should loop or not.

bool Loop { get set }

Origin

Gets the origin of the sprite. It is the same as the origin of the owner's transform component.

Vector2 Origin { get }

Visible

Gets or sets the visibility of the sprite. Default is true.

bool Visible { get set }

ImageIndex

Gets or sets the current frame of the animation.

int ImageIndex { get set }

Color

Gets or sets color using which the sprite is drawn. Default is white.

Color Color { get set }

CustomPosition

Vector2 CustomPosition { get set }

DisabledViewports

Gets a list of viewports on which the sprite will not be visible. If empty, it will be visible on all viewports.

List<string> DisabledViewports { get }

Methods

OnBegin override

void OnBegin()

OnComponentAdded override

void OnComponentAdded(BaseComponent component)

Parameters:

Name Type Description
component Strawberry.Core.BaseComponent

OnUpdate override

void OnUpdate()

OnRender override

void OnRender()