Search in sources :

Example 1 with RandomMoveControl

use of com.almasb.fxgl.entity.control.RandomMoveControl in project FXGL by AlmasB.

the class NoiseSample method initGame.

@Override
protected void initGame() {
    Entities.builder().at(100, 100).viewFromNodeWithBBox(new Rectangle(40, 40)).with(new RandomMoveControl(100, 50, 350, new Rectangle2D(0, 0, X_MAX - 0, Y_MAX - 0))).buildAndAttach(getGameWorld());
    Entities.builder().at(50, 350).viewFromNode(new Rectangle(15, 15, Color.DARKCYAN)).buildAndAttach(getGameWorld());
}
Also used : RandomMoveControl(com.almasb.fxgl.entity.control.RandomMoveControl) Rectangle(javafx.scene.shape.Rectangle) Rectangle2D(javafx.geometry.Rectangle2D)

Aggregations

RandomMoveControl (com.almasb.fxgl.entity.control.RandomMoveControl)1 Rectangle2D (javafx.geometry.Rectangle2D)1 Rectangle (javafx.scene.shape.Rectangle)1