Traits enable sharing logic between objects without the need of inheritance.
A trait is divided into five lifecycle-steps:
Each trait must define a callback-script, in which the logic for each of the above lifecycle-steps is defined. This script is virtually the object counterpart of the trait system. A trait is therefore just as powerful as an object, with the added benefit of being able to assign multiple traits to an object, while an object can have only one parent object.
Code-snippet that shows the setup of a trait: snippet_pp_trait_define
Code-snippet that shows a trait-script in action: snippet_pp_trait_callback
(C)opyright for the sprites: Kacper Woźniak
Version 1.1.0. Published April 13, 2018
This asset hasn't received enough reviews yet.
You can only review assets you've bought.