Pong | Creating the game objects: the ball.

We can now add the ball to the game.

  1. In the outline panel, right click, 'Collection' and choose, 'Add Game Object'. Note the keyboard shortcut for this is just pressing the letter A.

Add game object

  1. In the properties panel, change the 'Id' property from 'go' to 'ball'.
  1. In the outline panel, right click the 'ball' game object and choose, 'Add Component', 'Sprite'.

Game object add sprite

There is no need to change the Id of this because 'sprite' accurately describes what it is.

  1. In the properties panel, change the image property by clicking the three dots and choosing: /main/graphics.atlas
  1. Set the 'Default animation' property to ball.

Select animation for sprite

We need to move the ball to its starting position.

  1. Click ball game object in the outline panel (make sure it is the object you are selecting and not the sprite).
    In the properties panel set the X property to: 480 and the Y property to: 320.
  2. Save the changes by pressing CTRL-S or 'File', 'Save All'.

Your editor panel should now look like this:

Editor panel

The objects are now in the game in their starting positions on the canvas. The next stage is to tell the game what our input keys will be to move the paddles. Stage 4 >