Search in sources :

Example 1 with RandomAStarMoveComponent

use of com.almasb.fxgl.dsl.components.RandomAStarMoveComponent in project FXGL by AlmasB.

the class RandomPathfindingSample method spawnNPC.

private void spawnNPC(int x, int y) {
    var e = entityBuilder().viewWithBBox(new Rectangle(20, 20, FXGLMath.randomColor())).anchorFromCenter().with(new CellMoveComponent(CELL_WIDTH, CELL_HEIGHT, 150)).with(new AStarMoveComponent(grid)).with(new RandomAStarMoveComponent(1, 7, Duration.seconds(1), Duration.seconds(3))).buildAndAttach();
    e.getComponent(AStarMoveComponent.class).stopMovementAt(x, y);
}
Also used : CellMoveComponent(com.almasb.fxgl.pathfinding.CellMoveComponent) RandomAStarMoveComponent(com.almasb.fxgl.dsl.components.RandomAStarMoveComponent) Rectangle(javafx.scene.shape.Rectangle) AStarMoveComponent(com.almasb.fxgl.pathfinding.astar.AStarMoveComponent) RandomAStarMoveComponent(com.almasb.fxgl.dsl.components.RandomAStarMoveComponent)

Aggregations

RandomAStarMoveComponent (com.almasb.fxgl.dsl.components.RandomAStarMoveComponent)1 CellMoveComponent (com.almasb.fxgl.pathfinding.CellMoveComponent)1 AStarMoveComponent (com.almasb.fxgl.pathfinding.astar.AStarMoveComponent)1 Rectangle (javafx.scene.shape.Rectangle)1