|
@@ -80,7 +80,7 @@ Let's take a moment to familiarize ourselves with the various views in the edito
|
|
* <kbd>Scroll</kbd> to zoom in and out.
|
|
* <kbd>Scroll</kbd> to zoom in and out.
|
|
* <kbd>Alt + left mouse button</kbd> to pan around.
|
|
* <kbd>Alt + left mouse button</kbd> to pan around.
|
|
* <kbd>Ctrl + left mouse button</kbd> to rotate in 3D.
|
|
* <kbd>Ctrl + left mouse button</kbd> to rotate in 3D.
|
|
- * The menu <kbd>Scene ▸ Camera</kbd> includes tools to frame the view to the current selection and to realign the camera.
|
|
|
|
|
|
+ * The <kbd>View</kbd> menu includes tools to frame the view to the current selection and to realign the camera.
|
|
|
|
|
|
3. The *Outline* shows the content of the file currently being edited, but in a hierarchial tree structure. The outline reflects the editor view and allows you to perform many operations on your items:
|
|
3. The *Outline* shows the content of the file currently being edited, but in a hierarchial tree structure. The outline reflects the editor view and allows you to perform many operations on your items:
|
|
|
|
|
|
@@ -101,41 +101,41 @@ Let's take a moment to familiarize ourselves with the various views in the edito
|
|
|
|
|
|
The empty project template is not 100% empty so we should fix that:
|
|
The empty project template is not 100% empty so we should fix that:
|
|
|
|
|
|
-1. Open the file *main/main.collection*.
|
|
|
|
|
|
+1. Open the file "main/main.collection".
|
|
2. Mark the game object "logo" in either the outline or the editor.
|
|
2. Mark the game object "logo" in either the outline or the editor.
|
|
3. Delete the game object.
|
|
3. Delete the game object.
|
|
-4. Delete the file *main/images/logo.png* (you find it in the assets view).
|
|
|
|
-5. Delete the file *main/logo.atlas* (you find it in the assets view).
|
|
|
|
|
|
+4. Delete the file "main/images/logo.png" (you find it in the assets view).
|
|
|
|
+5. Delete the file "main/logo.atlas" (you find it in the assets view).
|
|
|
|
|
|
Now the project is totally empty. You can verify this by selecting <kbd>Project ▸ Build</kbd> from the menu. This will launch the game and you should see nothing but a black window.
|
|
Now the project is totally empty. You can verify this by selecting <kbd>Project ▸ Build</kbd> from the menu. This will launch the game and you should see nothing but a black window.
|
|
|
|
|
|
## Drawing the game map
|
|
## Drawing the game map
|
|
|
|
|
|
-Your game needs a setting, a map. The map that you are going to draw will be made out of tiles, small images that are put together like a mosaic into a larger image. In Defold, such an image is called a *Tile map*. In order to create a tile map, you need to import an image file that contain the various tiles. You then need to specify the size of the tiles, margins and padding on that image. This setup is done in a file called a *Tile source*.
|
|
|
|
|
|
+Your game needs a setting, a map. The map that you are going to draw will be made out of tiles, small images that are put together like a mosaic into a larger image. In Defold, such an image is called a *Tile map*. In order to create a tile map, you need to import an image file that contain the various tiles. You then need to specify the size of the tiles, margins and padding on that image. This setup is done in a file of a type called *Tile source*.
|
|
|
|
|
|
1. Download the "War Battles" asset package. The file is a ZIP archive that you have to unpack on your hard drive.
|
|
1. Download the "War Battles" asset package. The file is a ZIP archive that you have to unpack on your hard drive.
|
|
|
|
|
|
<a class="btn btn-primary btn-xs-block btn-icon" href="//storage.googleapis.com/defold-doc/assets/war-battles-assets.zip">Download asset package<span aria-hidden="true" class="icon icon-download"></span></a>
|
|
<a class="btn btn-primary btn-xs-block btn-icon" href="//storage.googleapis.com/defold-doc/assets/war-battles-assets.zip">Download asset package<span aria-hidden="true" class="icon icon-download"></span></a>
|
|
|
|
|
|
-2. Drag the file *map.png*, which contains all tiles, from the asset package to the folder *main* in the *Assets* view of your project.
|
|
|
|
|
|
+2. Drag the file "map.png", which contains all tiles, from the asset package to the folder "main" in the *Assets* view of your project.
|
|
|
|
|
|
-3. <kbd>Right click</kbd> the folder *main* and select <kbd>New ▸ Tile source</kbd>. This will create a new tile source file. Name the file "map.tilesource".
|
|
|
|
|
|
+3. <kbd>Right click</kbd> the folder *main* and select <kbd>New ▸ Tile source</kbd>. This will create a new tile source file. Name the file "map" (full name "map.tilesource").
|
|
|
|
|
|

|
|

|
|
|
|
|
|
-4. The new tilesource file opens automatically in the editor. Set the *Image* property of the tile source to the image file */main/map.png*. The easiest way to do that is to click the resource selector by the *Image* property to bring up the resource selector. Then select the file */main/map.png*:
|
|
|
|
|
|
+4. The new tilesource file opens automatically in the editor. Set the *Image* property of the tile source to the image file "/main/map.png". The easiest way to do that is to click the resource selector by the *Image* property to bring up the resource selector. Then select the file "/main/map.png":
|
|
|
|
|
|

|
|

|
|
|
|
|
|
The tiles are 16⨉16 pixels in the source image with no margins or padding so there is no need to alter the default properties of the tile source.
|
|
The tiles are 16⨉16 pixels in the source image with no margins or padding so there is no need to alter the default properties of the tile source.
|
|
|
|
|
|
-5. <kbd>Right click</kbd> the folder *main* and select <kbd>New ▸ Tile map</kbd>. Name the file "map.tilemap". The tile map is automatically opened in the editor view.
|
|
|
|
|
|
+5. <kbd>Right click</kbd> the folder *main* and select <kbd>New ▸ Tile map</kbd>. Name the file "map" (full name "map.tilemap"). The tile map is automatically opened in the editor view.
|
|
|
|
|
|
-6. Set the *Tile source* property of the new tile map to */main/map.tilesource*.
|
|
|
|
|
|
+6. Set the *Tile source* property of the new tile map to "/main/map.tilesource".
|
|
|
|
|
|
7. Select "layer1" in the *Outline*.
|
|
7. Select "layer1" in the *Outline*.
|
|
|
|
|
|
-8. Select <kbd>Scene ▸ Tile map ▸ Show palette</kbd>. This brings up the tile palette.
|
|
|
|
|
|
+8. Select <kbd>Edit ▸ Select Tile...</kbd>. This brings up the tile palette.
|
|
|
|
|
|

|
|

|
|
|
|
|
|
@@ -149,9 +149,9 @@ When you are happy with the map, it is time to add it to the game.
|
|
|
|
|
|
## Add the map to the game
|
|
## Add the map to the game
|
|
|
|
|
|
-Defold stores everything you build in *collections*. A collection is a container of game objects and other collections. In *game.project* you specify the collection that is loaded when the game starts up. This is initially set to the file */main/main.collection*.
|
|
|
|
|
|
+Defold stores everything you build in *collections*. A collection is a container of game objects and other collections. In the file "game.project" you specify the collection that is loaded when the game starts up. This is initially set to the file "/main/main.collection".
|
|
|
|
|
|
-1. Open the file *main.collection*.
|
|
|
|
|
|
+1. Open the file "main.collection".
|
|
|
|
|
|
2. <kbd>Right click</kbd> the root node of the collection in the *Outline* and select <kbd>Add game object</kbd>.
|
|
2. <kbd>Right click</kbd> the root node of the collection in the *Outline* and select <kbd>Add game object</kbd>.
|
|
|
|
|
|
@@ -159,11 +159,11 @@ Defold stores everything you build in *collections*. A collection is a container
|
|
|
|
|
|
3. Change the *Id* property of the game object to "map". The id does not really matter for this game object but it is a good habit to set identifiers that are descriptive---it makes it easier to find your way around when you have many game objects.
|
|
3. Change the *Id* property of the game object to "map". The id does not really matter for this game object but it is a good habit to set identifiers that are descriptive---it makes it easier to find your way around when you have many game objects.
|
|
|
|
|
|
-4. <kbd>Right click</kbd> the new game object and select <kbd>Add component file</kbd>.
|
|
|
|
|
|
+4. <kbd>Right click</kbd> the new game object and select <kbd>Add Component File</kbd>.
|
|
|
|
|
|

|
|

|
|
|
|
|
|
-5. In the resource selector, pick the file */main/map.tilemap*. This creates a new component in the game object based on the tilemap file. The tile map should now appear in the editor view.
|
|
|
|
|
|
+5. In the resource selector, pick the file "/main/map.tilemap". This creates a new component in the game object based on the tilemap file. The tile map should now appear in the editor view.
|
|
|
|
|
|

|
|

|
|
|
|
|
|
@@ -175,9 +175,9 @@ Defold stores everything you build in *collections*. A collection is a container
|
|
|
|
|
|
1. Drag the folder *units/infantry* from the asset package to the folder *main* in the *Assets* view. This copies a set of flip book animation frame images to your project. The images are divided into folders with one folder for each movement direction: up, down, up-diagonally, down-diagonally and side.
|
|
1. Drag the folder *units/infantry* from the asset package to the folder *main* in the *Assets* view. This copies a set of flip book animation frame images to your project. The images are divided into folders with one folder for each movement direction: up, down, up-diagonally, down-diagonally and side.
|
|
|
|
|
|
-2. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Atlas</kbd>. An atlas is a collection of images (PNG or JPEG) that are baked into a larger texture. Defold uses atlases instead of single image files for performance and memory reasons. The new atlas should open in the editor.
|
|
|
|
|
|
+2. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Atlas</kbd>. Name the new atlas file "sprites" (full name "sprites.atlas"). An atlas is a collection of images (PNG or JPEG) that are baked into a larger texture. Defold uses atlases instead of single image files for performance and memory reasons. The new atlas should open in the editor.
|
|
|
|
|
|
-3. <kbd>Right click</kbd> the root node of the atlas in the *Outline* and select <kbd>New ▸ Animation group</kbd>.
|
|
|
|
|
|
+3. <kbd>Right click</kbd> the root node of the atlas in the *Outline* and select <kbd>Add Animation Group</kbd>.
|
|
|
|
|
|
4. Select the new animation group and change its *Id* property to "player-down".
|
|
4. Select the new animation group and change its *Id* property to "player-down".
|
|
|
|
|
|
@@ -185,7 +185,7 @@ Defold stores everything you build in *collections*. A collection is a container
|
|
|
|
|
|

|
|

|
|
|
|
|
|
-6. With the animation group marked, select <kbd>Scene ▸ Play</kbd> from the menu to preview the animation. It will play back at full 60 FPS which is way too fast. Set the playback speed (*Fps* property) to 8.
|
|
|
|
|
|
+6. With the animation group marked, select <kbd>View ▸ Play</kbd> from the menu to preview the animation. It will play back at full 60 FPS which is way too fast. Set the playback speed (*Fps* property) to 8.
|
|
|
|
|
|

|
|

|
|
|
|
|
|
@@ -215,7 +215,7 @@ The player game object now has visual representation in the game world. The next
|
|
|
|
|
|
## Player input
|
|
## Player input
|
|
|
|
|
|
-1. Open the file */input/game.input_binding*. This file contains mappings from input sources (keyboard, touch screen, game pads etc) to input *actions*. Actions are just names that we want to associate with certain input.
|
|
|
|
|
|
+1. Open the file "/input/game.input_binding". This file contains mappings from input sources (keyboard, touch screen, game pads etc) to input *actions*. Actions are just names that we want to associate with certain input.
|
|
|
|
|
|
2. Add *Key triggers* for the four arrow keys. Name the actions "up", "down", "left" and "right".
|
|
2. Add *Key triggers* for the four arrow keys. Name the actions "up", "down", "left" and "right".
|
|
|
|
|
|
@@ -225,11 +225,11 @@ The player game object now has visual representation in the game world. The next
|
|
|
|
|
|
Unlike the sprite component, which you added directly into the "player" game object, a script component requires that you create a separate file. This script file is then used as basis for the script component.
|
|
Unlike the sprite component, which you added directly into the "player" game object, a script component requires that you create a separate file. This script file is then used as basis for the script component.
|
|
|
|
|
|
-1. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Script</kbd>. Name the new script file "player.script". The script file, pre-filled with template functions, opens up in the editor.
|
|
|
|
|
|
+1. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Script</kbd>. Name the new script file "player" (full name "player.script"). The script file, pre-filled with template functions, opens up in the editor.
|
|
|
|
|
|

|
|

|
|
|
|
|
|
-2. Open *main.collection*, <kbd>Right click</kbd> the game object "player" and select <kbd>Add component file</kbd>. Pick the new file */main/player.script* as the file to use for the component.
|
|
|
|
|
|
+2. Open *main.collection*, <kbd>Right click</kbd> the game object "player" and select <kbd>Add Component File</kbd>. Pick the new file "/main/player.script" as the file to use for the component.
|
|
|
|
|
|
You now have a script that runs in the "player" game object. It does not do anything yet though. Let's start by adding player movement.
|
|
You now have a script that runs in the "player" game object. It does not do anything yet though. Let's start by adding player movement.
|
|
|
|
|
|
@@ -307,13 +307,13 @@ What you need to is a *blueprint* for a rocket game object and then use some sor
|
|
|
|
|
|
## The rocket game object
|
|
## The rocket game object
|
|
|
|
|
|
-1. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Game Object</kbd>. Name this file *rocket.go*.
|
|
|
|
|
|
+1. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Game Object</kbd>. Name this file "rocket" (full name "rocket.go").
|
|
|
|
|
|
(Note that by creating this file, you do not create a new game object instance but a *blueprint* file for actual game object instances.)
|
|
(Note that by creating this file, you do not create a new game object instance but a *blueprint* file for actual game object instances.)
|
|
|
|
|
|
2. Drag the folder *buildings/turret-rocket* from the asset package to the *main* folder in the *Assets* view.
|
|
2. Drag the folder *buildings/turret-rocket* from the asset package to the *main* folder in the *Assets* view.
|
|
|
|
|
|
-3. Open *sprites.atlas* and create a new animation group (right click the root node and select <kbd>New ▸ Animation Group</kbd>). Name the animation "rocket".
|
|
|
|
|
|
+3. Open *sprites.atlas* and create a new animation group (right click the root node and select <kbd>Add Animation Group</kbd>). Name the animation "rocket".
|
|
|
|
|
|
4. Add the three rocket images to the animation group and set the *Fps* property to a value that makes the animation look good when you preview.
|
|
4. Add the three rocket images to the animation group and set the *Fps* property to a value that makes the animation look good when you preview.
|
|
|
|
|
|
@@ -327,11 +327,11 @@ Now you have a basic rocket game object blueprint, on file. The next step is to
|
|
|
|
|
|
## Spawning rockets
|
|
## Spawning rockets
|
|
|
|
|
|
-1. Open *main.collection* and <kbd>Right click</kbd> on the "player" game object. Select <kbd>Add Component ▸ Factory</kbd>.
|
|
|
|
|
|
+1. Open "main.collection" and <kbd>Right click</kbd> on the "player" game object. Select <kbd>Add Component ▸ Factory</kbd>.
|
|
|
|
|
|
-2. Select the new factory component and set its *Id* property to "rocketfactory" and its *Prototype* to the file */main/rocket.go* (the one you created above). Now the player game object is all set.
|
|
|
|
|
|
+2. Select the new factory component and set its *Id* property to "rocketfactory" and its *Prototype* to the file "/main/rocket.go" (the one you created above). Now the player game object is all set.
|
|
|
|
|
|
-3. Open the file */input/game.input_binding*.
|
|
|
|
|
|
+3. Open the file "/input/game.input_binding".
|
|
|
|
|
|
4. Add a *Key trigger* for the firing action. Call this action "fire".
|
|
4. Add a *Key trigger* for the firing action. Call this action "fire".
|
|
|
|
|
|
@@ -377,7 +377,7 @@ Now you have a basic rocket game object blueprint, on file. The next step is to
|
|
1. If the `firing` flag is true, tell the factory component called "rocketfactory" that you just created to spawn a new game object. Note the character '#' that indicates that what follows is the id of a component.
|
|
1. If the `firing` flag is true, tell the factory component called "rocketfactory" that you just created to spawn a new game object. Note the character '#' that indicates that what follows is the id of a component.
|
|
2. Set the firing flag to false. This flag will be set in `on_input()` each frame the player presses the fire key.
|
|
2. Set the firing flag to false. This flag will be set in `on_input()` each frame the player presses the fire key.
|
|
|
|
|
|
-7. Scroll down to the `on_input()` function. Add a fourth `elseif` for the case where the function is called with the "fire" action and only the one frame when the key is pressed down:
|
|
|
|
|
|
+7. Scroll down to the `on_input()` function. Add a fifth `elseif` for the case where the function is called with the "fire" action and only the one frame when the key is pressed down:
|
|
|
|
|
|
```lua
|
|
```lua
|
|
...
|
|
...
|
|
@@ -421,7 +421,7 @@ If you run the game now you should be able to move around and drop rockets all o
|
|
|
|
|
|
Note that the rocket needs a movement direction in addition to the game object rotation (`rot`). It would be possible to make the rocket calculate its movement vector based on its rotation, but it is easier and more flexible to separate the two values. For instance, with a separate rotation it is possible to add rotation wobble to the rocket without it affecting the movement direction.
|
|
Note that the rocket needs a movement direction in addition to the game object rotation (`rot`). It would be possible to make the rocket calculate its movement vector based on its rotation, but it is easier and more flexible to separate the two values. For instance, with a separate rotation it is possible to add rotation wobble to the rocket without it affecting the movement direction.
|
|
|
|
|
|
-3. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Script</kbd>. Name the new script file "rocket.script". Replace the template code in the file with the following:
|
|
|
|
|
|
+3. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Script</kbd>. Name the new script file "rocket" (full name "rocket.script"). Replace the template code in the file with the following:
|
|
|
|
|
|
```lua
|
|
```lua
|
|
go.property("dir", vmath.vector3()) -- <1>
|
|
go.property("dir", vmath.vector3()) -- <1>
|
|
@@ -442,7 +442,7 @@ If you run the game now you should be able to move around and drop rockets all o
|
|
4. Calculate a new position based on the old position, the movement direction and the speed.
|
|
4. Calculate a new position based on the old position, the movement direction and the speed.
|
|
5. Set the new position.
|
|
5. Set the new position.
|
|
|
|
|
|
-4. Open *rocket.go* and <kbd>Right click</kbd> the root in the *Outline* and select <kbd>Add Component ▸ Script</kbd>. Select the file *rocket.script* as basis for the component.
|
|
|
|
|
|
+4. Open *rocket.go* and <kbd>Right click</kbd> the root in the *Outline* and select <kbd>Add Component File</kbd>. Select the file "rocket.script" as basis for the component.
|
|
|
|
|
|
5. Run the game and try the new mechanic. Notice that the rockets fly in the right direction but are oriented 180 degrees wrong. That's an easy fix.
|
|
5. Run the game and try the new mechanic. Notice that the rockets fly in the right direction but are oriented 180 degrees wrong. That's an easy fix.
|
|
|
|
|
|
@@ -462,7 +462,7 @@ Now you only need to make the rockets explode a short while after they are fired
|
|
|
|
|
|
1. Drag the folder *fx/explosion* from the asset package to the main folder in the Assets view.
|
|
1. Drag the folder *fx/explosion* from the asset package to the main folder in the Assets view.
|
|
|
|
|
|
-2. Open *sprites.atlas* and create a new animation group (right click the root node and select <kbd>New ▸ Animation Group</kbd>). Call the animation "explosion".
|
|
|
|
|
|
+2. Open *sprites.atlas* and create a new animation group (right click the root node and select <kbd>Add Animation Group</kbd>). Call the animation "explosion".
|
|
|
|
|
|
3. Add the nine explosion images to the animation group and set the *Fps* property to a value that makes the animation look good when you preview. Also make sure that this animation has the *Playback* property set to `Once Forward`.
|
|
3. Add the nine explosion images to the animation group and set the *Fps* property to a value that makes the animation look good when you preview. Also make sure that this animation has the *Playback* property set to `Once Forward`.
|
|
|
|
|
|
@@ -523,11 +523,11 @@ This is definitely getting somewhere! But don't you think you need something to
|
|
|
|
|
|
## The tank game object
|
|
## The tank game object
|
|
|
|
|
|
-1. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Game Object</kbd>. Name this file *tank.go*. Like the rocket game object, this is a file that can be used as a *blueprint* when creating actual tank game objects.
|
|
|
|
|
|
+1. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Game Object</kbd>. Name this file "tank" (full name "tank.go"). Like the rocket game object, this is a file that can be used as a *blueprint* when creating actual tank game objects.
|
|
|
|
|
|
2. Drag the folder *units/tank* from the asset package to the *main* folder in the *Assets* view.
|
|
2. Drag the folder *units/tank* from the asset package to the *main* folder in the *Assets* view.
|
|
|
|
|
|
-3. Open *sprites.atlas* and create a new animation group (right click the root node and select <kbd>New ▸ Animation Group</kbd>). Name the animation "tank-down".
|
|
|
|
|
|
+3. Open *sprites.atlas* and create a new animation group (right click the root node and select <kbd>Add Animation Group</kbd>). Name the animation "tank-down".
|
|
|
|
|
|
4. Add the two downwards facing images (*/main/tank/down/1.png* and */main/tank/down/2.png*) to the animation and set it's *Fps* value to something that looks good.
|
|
4. Add the two downwards facing images (*/main/tank/down/1.png* and */main/tank/down/2.png*) to the animation and set it's *Fps* value to something that looks good.
|
|
|
|
|
|
@@ -559,7 +559,7 @@ Run the game and check that the tanks look okay. You will notice that if you fir
|
|
|
|
|
|

|
|

|
|
|
|
|
|
-6. Open *rocket.go* and <kbd>Right click</kbd> the root in the *Outline* and select <kbd>Add component ▸ Collision Object</kbd>.
|
|
|
|
|
|
+6. Open *rocket.go* and <kbd>Right click</kbd> the root in the *Outline* and select <kbd>Add Component ▸ Collision Object</kbd>.
|
|
|
|
|
|
7. Set the *Type* property to "Kinematic".
|
|
7. Set the *Type* property to "Kinematic".
|
|
|
|
|
|
@@ -613,17 +613,17 @@ Run the game and destroy some tanks! The tanks aren't very interesting enemies,
|
|
|
|
|
|
## Scoring GUI
|
|
## Scoring GUI
|
|
|
|
|
|
-1. Drag the the file *fonts/04font.ttf* from the asset pack folder to the *main* folder in the *Assets* view.
|
|
|
|
|
|
+1. Drag the the file "fonts/04font.ttf" from the asset pack folder to the "main" folder in the *Assets* view.
|
|
|
|
|
|
-2. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Font</kbd>. Name this file *text.font*.
|
|
|
|
|
|
+2. <kbd>Right click</kbd> the folder "main" in the *Assets* view and select <kbd>New ▸ Font</kbd>. Name this file "text" (full name "text.font").
|
|
|
|
|
|
-3. Open *text.font* and set the *Font* property to the file *04font.ttf*.
|
|
|
|
|
|
+3. Open *text.font* and set the *Font* property to the file "04font.ttf".
|
|
|
|
|
|

|
|

|
|
|
|
|
|
-4. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Gui</kbd>. Name this file *ui.gui*. It will contain the user interface where you will place the score counter.
|
|
|
|
|
|
+4. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Gui</kbd>. Name this file "ui" (full name "ui.gui"). It will contain the user interface where you will place the score counter.
|
|
|
|
|
|
-5. Open *ui.gui*. <kbd>Right click</kbd> *Fonts* in the *Outline* view and select <kbd>Add ▸ Fonts</kbd>. Select the */main/text.font* file.
|
|
|
|
|
|
+5. Open "ui.gui". <kbd>Right click</kbd> *Fonts* in the *Outline* view and select <kbd>Add ▸ Fonts</kbd>. Select the "/main/text.font" file.
|
|
|
|
|
|
6. <kbd>Right click</kbd> *Nodes* in the *Outline* view and select <kbd>Add ▸ Text</kbd>.
|
|
6. <kbd>Right click</kbd> *Nodes* in the *Outline* view and select <kbd>Add ▸ Text</kbd>.
|
|
|
|
|
|
@@ -633,15 +633,15 @@ Run the game and destroy some tanks! The tanks aren't very interesting enemies,
|
|
|
|
|
|

|
|

|
|
|
|
|
|
-9. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Gui Script</kbd>. Name this new file "ui.gui_script".
|
|
|
|
|
|
+9. <kbd>Right click</kbd> the folder *main* in the *Assets* view and select <kbd>New ▸ Gui Script</kbd>. Name this new file "ui" (full name "ui.gui_script").
|
|
|
|
|
|
-10. Go back to *ui.gui* and select the root node in the *Outline*. Set the *Script* property to the file */main/ui.gui_script* that you just created. Now if we add this Gui as a component to a game object the Gui will be displayed and the script will run.
|
|
|
|
|
|
+10. Go back to "ui.gui" and select the root node in the *Outline*. Set the *Script* property to the file "/main/ui.gui_script" that you just created. Now if we add this Gui as a component to a game object the Gui will be displayed and the script will run.
|
|
|
|
|
|
11. Open *main.collection*.
|
|
11. Open *main.collection*.
|
|
|
|
|
|
12. <kbd>Right click</kbd> the root node of the collection in the *Outline* and select <kbd>Add Game Object</kbd>.
|
|
12. <kbd>Right click</kbd> the root node of the collection in the *Outline* and select <kbd>Add Game Object</kbd>.
|
|
|
|
|
|
-13. Set the *Id* property of the game object to "gui", then <kbd>Right click</kbd> it and select <kbd>Add Component File</kbd>. Select the file */main/ui.gui*. The new component will automatically get the *Id* "ui".
|
|
|
|
|
|
+13. Set the *Id* property of the game object to "gui", then <kbd>Right click</kbd> it and select <kbd>Add Component File</kbd>. Select the file "/main/ui.gui". The new component will automatically get the *Id* "ui".
|
|
|
|
|
|

|
|

|
|
|
|
|