Closed Noah2610 closed 4 years ago
Configure entity variants like in the config mockup above.
Example config for an enemy with variations MoveLeft
and MoveRight
.
Within tiled, set the variant
property on an entity to a variant's name, to use that variant.
Switch variants during runtime with the event action: EntityAction(SwitchVariant("VariantName"))
Example.
Note: Right now, switching variants like this only works for the components
and the events
fields. (TODO)
Working, but not quite finished. Closing for now.
Introduce variants for
EntityConfig
. Variants allow anEntityConfig
to have optional groups ofEntityConfig
s.Use-case example
Let's say we have an enemy, that just stands still. For some instances of that enemy type, we may want to make it move. We could have a variant called "Walker", that adds the
Walker
component.Config mockup
Using a variant
In code, editing an entity with its
EntityConfig
, we could pass an optionalvariant
string.For example for enemies, when placing an enemy within Tiled, they always get a
type
value. In addition to its type, we could give it an optionalvariant
property.Switching variants at runtime
Out of scope for this issue, but it would be cool to be able to switch variant type via an action or such.