Skip to content
This repository was archived by the owner on Dec 30, 2023. It is now read-only.

Caveats

skellypupper edited this page Feb 13, 2023 · 8 revisions

Unfortunately there are quite a few things that can't be done in hscript the same way they can be done in haxe. This page is here to tell you what a few of those observed things are and how they can be worked around.

FlxSprite#makeGraphic doesn't appear

No understood reason for why this happens. If you're adding a color, you have to set it as a property instead of a function argument.

var coolSprite = new FlxSprite().makeGraphic(27, 27);
coolSprite.color = 0x000000;

Enum types don't work

Enum types aren't supported in hscript and there is no workaround for this. This means you cannot use enum property arguments in your scripts. (i.e sprite.screenCenter(X);)

import doesn't work

While the import keyword is supported, some modules won't import properly with it. Edak has a backup function which should work in this case: importLib.

// if this isn't working
import flixel.group.FlxTypedGroup;
// try this
importLib("flixel.group.FlxTypedGroup");

If you'd like to import a module under an alias name (like as), you can add a second arg to the function to rename it. (i.e importLib("flixel.FlxBasic", "BasicButAwesome");) If a module is already imported to your script and you try to import it again, it won't import anything. Same with importing non-existent modules.

FlxColor/Abstract Types

FlxColor is an abstract type which isn't supported by hscript. Currently there is no workaround for this. You can still use hex ints as color values.

Clone this wiki locally