Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Previous: Introduction Next: Interact with the viewer

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.LINEAR)
	.setY(player.getY(), Curve.LINEAR);

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);
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content