use of com.almasb.fxgl.entity.component.ActivatorComponent in project FXGL by AlmasB.
the class ScriptSample method initGame.
@Override
protected void initGame() {
player = Entities.builder().at(100, 100).viewFromNodeWithBBox(new Rectangle(40, 40, Color.BLUE)).with(new DeveloperWASDControl()).buildAndAttach(getGameWorld());
enemy = Entities.builder().at(180, 100).viewFromNodeWithBBox(new Rectangle(30, 30, Color.RED)).with(new AliveComponent(true)).with(new ActivatorComponent(), new IDComponent("wanderer", 0)).with("onActivate", "first_script.js").with("onActivate.name", "wanderer").with("onActivate.id", 0).with("onDeath", "second_script.js").with("onRevive", "first_script.js").buildAndAttach(getGameWorld());
Entities.builder().at(380, 100).viewFromNodeWithBBox(new Rectangle(30, 30, Color.RED)).with(new AliveComponent(true)).with(new ActivatorComponent(), new IDComponent("wanderer", 1)).with("onActivate", "second_script.js").with("onActivate.name", "wanderer").with("onActivate.id", 1).buildAndAttach(getGameWorld());
}
Aggregations