Open
Description
Reproducible:
Main.hx
package;
import haxe.Timer;
import exp.ecs.Engine;
class Main {
static function main() {
var engine = new Engine();
engine.systems.add(new MovementSystem());
// run the engine
new Timer(16).run = function() engine.update(16 / 1000);
}
}
MovementSystem.hx
package;
import exp.ecs.component.Component;
import Main;
import exp.ecs.node.Node;
import tink.CoreApi.Noise;
import exp.ecs.system.System;
class MovementSystem extends System<Noise> {
// prepares a NodeList that contains entities having both the Position and Velocity components
@:nodes var nodes:Node<Velocity<Int>>;
override function update(dt:Float) {
// on each update we iterate all the nodes and update their Position components
for(node in nodes) {
// node.velocity.y += dt;
}
}
}
class Velocity<Type> extends Component {
public function new(test:Type):Void {
}
}```
Error:
Message: src/MovementSystem.hx:9: characters 20-34 : Expected a class that extends Component, but Velocity doesn't.```
Metadata
Metadata
Assignees
Labels
No labels