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.
- In the assets panel, in the 'main' folder, double click, 'main.collection'.
- 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'.
- In the properties panel, change the 'Id' property to 'target'.
- In the properties panel, change 'Position X' to -100. Change 'Position Y' to -100.
- In the outline panel, right click, 'Collection' and select, 'Add Game Object'.
- Give the target the appropriate sprite.
Step-by-step guide
- In the outline panel, right click 'target'. Select, 'Add Component', 'Sprite'.
- In the properties window, change the 'Image' property to '/main/graphics.atlas'.
- In the properties window, change the 'Defaul Animation' to 'target'.
- In the outline panel, right click 'target'. Select, 'Add Component', 'Sprite'.
- 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'.
- In the properties panel, change the 'Type' property to, 'Kinematic'.
- In the outline panel, right click 'collisionobject' and select, 'Add Shape', 'Sphere'.
- Use the resize the object tool and the bluie/orange square handle to match the size of the target.
- In the outline panel, right click 'target'. Select, 'Add Component', 'Collision Object'.
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.
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 >