Incoming | Creating the game objects: player target

Try to create the player target object on your own so that you begin to remember how to make objects in Defold. If you get stuck, there are guides to follow.

  1. In the assets panel, in the 'main' folder, double click, 'main.collection'.
  2. Create a new game object in the collection with the Id, 'target'. The X position should be -100 and the Y position should be -100. This keeps the target off the screen until the mouse button is pressed.

    Step-by-step guide
    • In the outline panel, right click, 'Collection' and select, 'Add Game Object'.
      Add game object
    • In the properties panel, change the 'Id' property to 'target'.
    • In the properties panel, change 'Position X' to -100. Change 'Position Y' to -100.
      Target properties
  3. Give the target the appropriate sprite.

    Step-by-step guide
    • In the outline panel, right click 'target'. Select, 'Add Component', 'Sprite'.
      Add sprite
    • In the properties window, change the 'Image' property to '/main/graphics.atlas'.
    • In the properties window, change the 'Defaul Animation' to 'target'.
      Target sprite properties
  4. Create a collision object sphere that is the same size as the target sprite.

    Step-by-step guide
    • In the outline panel, right click 'target'. Select, 'Add Component', 'Collision Object'.
      Target collision object
    • In the properties panel, change the 'Type' property to, 'Kinematic'.
    • In the outline panel, right click 'collisionobject' and select, 'Add Shape', 'Sphere'.
      Add collision object sphere
    • Use the resize the object tool and the bluie/orange square handle to match the size of the target.
    • Editor tools

Once you have finished, your editor, outline and properties window for the collision object should look like this. Check the names and properties carefully before continuing.

Target object complete

We are now ready to create the comet game object. This will be a slightly different process because it doesn't belong to a collection. Stage 3d >