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
Documentation: API
Changelog:
1.1.0:
(C)opyright for the sprites: Kacper Woźniak
End User Licence Agreement (EULA).