Graphical Entities

Every sprite, shape, text, etc are entities displayable in the viewer. They implement diverse methods to be manipulated:

  • Position
  • Rotation
  • Anchor
  • Scale
  • Opacity
  • Z index


Creating a circle

// Creates a green circle
Circle circle = graphicEntityModule.createCircle()

Moving a circle

MyPlayer player = gameManager.getPlayer(turn % 2);

With a Curve

	.setX(player.getX(), Curve.EASE_IN_AND_OUT)
	.setY(player.getY(), Curve.EASE_IN_AND_OUT);

By default the Curve.LINEAR is used.

It should look like this : Example The first circle is not animated, the second is animated with the default curve and the last one is animated with the custom curve.

Creating a group of sprites

Sprite planet1 = graphicEntityModule.createSprite()
Sprite planet2 = graphicEntityModule.createSprite()
Sprite planet3 = graphicEntityModule.createSprite()

// The planets are around the point (960,540).
Group system = graphicEntityModule.createGroup(planet1, planet2, planet3)

Spinning a group of spinning sprites around a point

	planet1.setRotation(planet1.getRotation() - Math.PI / 4);
	planet2.setRotation(planet2.getRotation() + Math.PI);
	planet3.setRotation(planet3.getRotation() + Math.PI / 16);
	system.setRotation(system.getRotation() + Math.PI / 2);

It should look like this : Example

Create your playground on
This playground was created on, our hands-on, knowledge-sharing platform for developers.
Go to