Skip to content

Latest commit

 

History

History
58 lines (32 loc) · 2.46 KB

prefabs.md

File metadata and controls

58 lines (32 loc) · 2.46 KB

Prefabs

Prefabs are prefabricated game entities intended for simple and one-time-use of a component. Thus, there is one prefab for each class-type component. There is also, currently, one other experimental prefab for gestures.

Note that most prefabs do not implement gestures as that is generally beyond the intended purpose of prefabs. If nothing else, it would lead to too many prefab variants. It is possible to extend a prefab with gesture mixins but this is not considered best practice versus extending GameEntity... but not really considered bad practice either. It's a style choice.

Built-in prefabs
SpritePrefab
AnimationPrefab
MessageBoxPrefab
NinePatchPrefab
ParallaxPrefab
ParticlePrefab
TapAreaPrefab
TextPrefab
TimerPrefab

SpritePrefab

Implements SpriteComponent.

AnimationPrefab

Implements AnimationComponent.

Adds destroyOnFinish constructor parameter and property.

MessageBoxPrefab

Implements MessageBoxComponent.

Adds destroyOnFinish constructor parameter and property.

NinePatchPrefab

Implements NinePatchComponent.

ParallaxPrefab

Implements ParallaxComponent.

ParticlePrefab

Implements ParticleComponent.

Currently has a progress property... but can't promise what it might have after a needed refactor.

TapAreaPrefab

Implements the GestureArea mixin and the TapDetector mixin and no visual components. Experimental.

This is intended for use only with overly-simple GUI objects that have more than one hot spot. For example, a yes/no message box with static, pre-drawn buttons. If, instead, you have a separate button object, that button should be its own GameEntity with gesture mixins, plus a visual component (such as an AnimationComponent, for example).

TextPrefab

Implements TextComponent.

TimerPrefab

Implements TimerComponent.

TODO: Adds destroyOnFinish constructor parameter and property.