You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
well it seems like i have no idea how these work myself
3
+
Custom classes can be made either inside the script you need it in or you can make a script file coresponding with the name of the class in ``./source``, and using `import` to import it.
4
+
5
+
Here is a basic Song Script code that uses it:
6
+
```hx
7
+
class SpecialSprite extends FlxSprite {
8
+
public var customValue:String = null;
9
+
public function new(x:Float, y:Float, customValue:String) {
10
+
super(x, y);
11
+
this.customValue = customValue;
12
+
//other code stuff
13
+
}
14
+
15
+
public override function update(elapsed) {
16
+
super.update(elapsed);
17
+
}
18
+
}
19
+
20
+
function create() {
21
+
var spr = new SpecialSprite(200, 400, "powerful");
22
+
add(spr);
23
+
}
24
+
```
25
+
26
+
### Particularities
27
+
As of writing this, this system is very limited and also presents some defects. For example:
28
+
- You cannot extend FlxGroups or other typed classes *(the ones that end with a ``<T>``)*.
29
+
- Certain classes like FlxText needs to have their ``update`` function manually called.
30
+
- all variables need to be public in order to be accessed inside the class.
0 commit comments