Before we continue, the tiled background should be locked. As we create and move around objects on top of it, it's easy to accidentally select or modify the background. Since we don't need to change the background any more, locking it makes it unselectable, so it won't get in the way. To lock it, right-click on the tiled background and select Lock►Lock selection. (If you do want to change it later on, right-click and select Lock►Unlock all.)
Add the input objects
Double-click in a space (this can be anywhere since the tiled background is locked) to add another new object. This time, select the Mouse object, since we'll need mouse input. Do the same again for the Keyboard object.
Note that these objects don't need placing in a layout. They are hidden, and automatically work across the entire project. Now all layouts in our project can accept mouse and keyboard input.
The game objects
It's time to add our game objects! Here are your images - save them all to your computer as you did before with the background image.
Player image:
Goblin image:
Spell image:
Spark flash image:
For each of these objects, we will add a Sprite object. Sprites display an image, which you can move about, rotate, resize and optionally animate. Games are generally composed mostly out of sprite objects. Let's add each of the above four objects as sprite objects. The process is similar to inserting the Tiled Background:
- Double click to insert a new object
- Double click the Sprite object.
- When the mouse turns to a crosshair, click somewhere in the layout to place it
- The image editor pops up. Click the Load image button, and load one of the four images.
- Close the image editor. You should now see the object in the layout!
These objects will be called Sprite, Sprite2, Sprite3 and Sprite4. That's not very useful - things will quickly get confusing like this. Rename them to Player, Goblin, Spell and SparkFlash as appropriate. You can do it by selecting the object, then changing the Name property in the properties bar:
Move the Spell and SparkFlash sprites to somewhere off the edge of the layout - we don't want to see them when the game starts.