Skip to content

Guide Create Sprite

Carlonn Rivers edited this page Aug 12, 2020 · 8 revisions

Creating A Sprite

Sprites are one of the main visuals/appearances behind prefabs in FlevaR. Other visual flobtives are graphics, spritesheets and paintings.

To create a sprite, we call the flevar.createSprite(name, props*, definition*) method:

flevar.createSprite("first_sprite");

The sprite is then added to FlevaR's library.


All flobtive names must be unique to their flobtive.

See documentation for detailed naming conventions.

For now, leaving the definition and props parameters empty would use a the default FlevaR sprite:

default_sprite

Using a Sprite

To use a sprite with our prefab, we call the prefab.useSprite(name); method in the prefab's setAppearance function:

prefab.useSprite("first_sprite");

This sets the current visuals of the target prefab to first_sprite.


Everything is finally in place with creating our first application.

Since there's nothing else left to do, let's start the application!