Blender Game Engine:Beginner's Guide
上QQ阅读APP看书,第一时间看更新

Time for action — appending the enemy

It is recommended that you create a folder called library, and create subfolders under it, as your library grows. For example, under the enemy folder, you might want to create folders for animals, ships, food, and so on. If you have a good library with .blend files that has really neat objects used in it, then you can, from your current .blend file, link all of the objects into your current .blend file (level 01).

  1. Choose File | Append and select the ship file. Press Link Append File by right-clicking on the Library button. The results will look like the following:
    Time for action — appending the enemy
  2. Work from the top, 3D view and select the enemy (ship). Scale it and move it as you like.

What just happened?

We have placed the player, objects, and enemy in the top view, to give us a better understanding of the position of each element in the level we are preparing.

We use the Append option to import objects from the library. It allows us greater error correction if we want to modify any object at any moment.

If you use the Linked option, you cannot edit the object since all you have is a link to it. You cannot add to it or change it, because its source is in another file that is not open. However, you can modify the source, which will reflect in the linked blend files. This works very well for objects we want to share, which are not unique throughout the game.

Pop quiz — Involving enemies in the game

  1. For a complete library, we need to:
    1. Create a single folder
    2. Have several separate folders
    3. Sort objects in multiple folders
  2. What extension should have the files for a clean library?
    1. .dae
    2. .obj
    3. .blend
  3. To share objects, which files must we work with?
    1. Insert
    2. Append
    3. Link

Have a go hero—reshaping the level

You already have a lot of information, which is required, to know what objects you need for each level of the game, and how you should apply them in your first level. In any case, we did not miss much emphasis on the measurements of each object, and as an example, our icebergs can be of many shapes and sizes. By changing its scale and rotation, you are bound to find plenty of possibilities with a single object. Remember that if you use the Link option, all of the original files in your folders libraries will be updated with iceberg-modifying sources. Learn your options and you will save a lot of time.

Try to move and reposition objects so that your player and the enemy can touch. However, you should reposition the objects again, if the battle overlaps the icebergs. With a few lines in the following section, we will see how the enemy moves, so be prepared!