Search in sources :

Example 1 with AIControl

use of com.almasb.fxgl.ai.AIControl in project FXGL by AlmasB.

the class BehaviorSample method initGame.

@Override
protected void initGame() {
    player = Entities.builder().at(100, 100).viewFromNode(new Rectangle(40, 40)).with(new PlayerControl()).buildAndAttach(getGameWorld());
    playerControl = player.getControl(PlayerControl.class);
    Entities.builder().at(400, 100).viewFromNode(new Rectangle(40, 40, Color.RED)).with(new AIControl("patrol.tree")).buildAndAttach(getGameWorld());
    Entities.builder().at(600, 100).viewFromNode(new Rectangle(40, 40, Color.LIGHTGOLDENRODYELLOW)).with(new AIControl("patrol.tree")).buildAndAttach(getGameWorld());
}
Also used : AIControl(com.almasb.fxgl.ai.AIControl) Rectangle(javafx.scene.shape.Rectangle) PlayerControl(common.PlayerControl)

Aggregations

AIControl (com.almasb.fxgl.ai.AIControl)1 PlayerControl (common.PlayerControl)1 Rectangle (javafx.scene.shape.Rectangle)1