Files
Leenkx_Examples/tilesheet/Sources/lnx/AnimControl.hx
2026-10-25 12:04:24 -07:00

23 lines
442 B
Haxe

package lnx;
class AnimControl extends iron.Trait {
var tilesheet:iron.object.Tilesheet;
public function new() {
super();
notifyOnInit(function() {
tilesheet = cast(object, iron.object.MeshObject).activeTilesheet;
iron.system.Tween.timer(Std.random(8), playAnim);
});
}
function playAnim() {
tilesheet.play("rest", function() {
tilesheet.play("idle");
iron.system.Tween.timer(Std.random(8), playAnim);
});
}
}