Gallery Items

The gallery items that will serve as targets for our game will be made up of seven different animals. There will be five copies of each animal for a total of 35 animals. For each animal, we’ll create an array of five of the animals and position them, scale them, and color them. Each of the animals will be a .3ds file that we will load. Let’s start by creating the ducks, and then we’ll create the other animals. Add the following code:

EntityTexture terrain,tex
EntityType terrain, type_scenery
;Creating the gallery items

Dim ducks(5)

For x = 1 To 5
ducks(x)= LoadMesh ("duck.3ds")
PositionEntity ducks(x), x*15,0,90
EntityColor ducks(x), 255,255,0
ScaleEntity ducks(x), 0.2,0.2,0.2
Next

Run the program now, and with any luck you should have five ducks across the screen, as in Figure 14.11.

Figure 14.11. The array you created should produce five yellow ducks.


Now we need to re-create this array for the other animals. The code will look almost exactly the same with the exception that we’ll change the animal name and adjust their position and size.

;Creating the gallery items

Dim ducks(5)
      For x= 1 To 5
ducks(x)= LoadMesh ("duck.3ds")
PositionEntity ducks(x), x*15,0,90
EntityColor ducks(x), 255,255,0
ScaleEntity ducks(x), 0.2,0.2,0.2
      Next

Dim seahorse(5)
For x = 1 To 5
seahorse(x)= LoadMesh ("seahorse.3ds")
PositionEntity seahorse(x), x*6,10,45
EntityColor seahorse(x), 255,102,0
ScaleEntity seahorse(x), 0.03,0.03,0.03
Next

Dim donkey(5)
For x = 1 To 5
donkey(x)= LoadMesh ("donkey.3ds")
PositionEntity donkey(x), x*5,35,85
EntityColor donkey(x), 204,204,204
ScaleEntity donkey(x), 0.3,0.3,0.3
Next

Dim flamingo(5)
For y = 1 To 5
flamingo(y)= LoadMesh ("flamingo.3ds")
PositionEntity flamingo(y), y*6,8,25
EntityColor flamingo(y), 102,51,51
ScaleEntity flamingo(y), 0.003,0.003,0.003
Next

Dim dolphin(5)
For x = 1 To 5
dolphin(x)= LoadMesh ("dolphin.3ds")
PositionEntity dolphin(x), x*6,45,0
EntityColor dolphin(x), 102,153,255
ScaleEntity dolphin(x), 0.3,0.3,0.3
Next

Dim snake(5)
For x = 1 To 5
snake(x)= LoadMesh ("snake.3ds")
PositionEntity snake(x), x*16,10,10
EntityColor snake(x), 153,255,153
ScaleEntity snake(x), 0.06,0.06,0.06
Next

Run the program now, and you should see many of the animals, as in Figure 14.12.

Figure 14.12. You’ll see some of the animals at this point, but not all because they are spread out in different locations around the playing field.


Note: Changing the Animals

Feel free to import the animal models into 3ds Max and alter them using some of the techniques you learned earlier in the book.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.222.6