I was curious what it was because with a different hscript class I use they had a parenting system. // soure classclassCoolSpriteextendsFlxSprite {
publicvarcheese:Int=0;
publicvarscript:Script=newScript(this);
// pretend there are script calls for func create and shit lol
}
// script contentsfunctioncreate():Void {
trace(cheese); // 0cheese++;
trace(cheese); // 1
} |
Answered by
Kriptel
Dec 5, 2024
Replies: 1 comment 1 reply
By setting source varobject:FlxSprite=newFlxSprite(100,0);
varscript:RuleScript=newRuleScript();
script.superInstance=object;
// ... script executescript trace(x); // 100, because sprite's x value is 100x=200;
trace(x) // 200, It will also change for the object |
1 reply
Answer selected byrodney528
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
By setting
superInstanceto a non-null value, you are telling scripts that it should change variables in the parent class, if any exist.source
script