|Top Previous Next|
This month's "plug and play" section of the magazine includes 2 projects that have something in common: they use the breadcrumb navigation technique. The player creates bread crumbs (small entities) while it is moving; its ally is then able to navigate from one crumb to the other until it finds the player.
Open the \teamallies folder, and then load the warehouse level from inside the \demo folder. This is the easiest breadcrumb example; we've got a friendly mummy that follows the player all over the place.
The crumbs are visible in this example; you will see that the mummy is able to find the player even if it chooses to use a complicated route, such as the one below.
The mummy will stop as soon as it has arrived close enough to the player.
The second project is located inside the \npckey folder and builds on the code of the first project, creating an "real" example that would work very well in an RPG game. Here, we've got a warlock that is able to open doors for our beloved player, but won't do his magic until he is being paid.
This is what you would see if you'd approach the warlock without having the needed money.
Go and find a few gold pieces (they're nearby) and then give them to the warlock by approaching it; you should see a picture that looks like this:
Now get inside the warehouse and approach the big, locked door. The warlock will follow you (he's a bit older than you, so don't rush him) and if at least one of your (invisible, in this example) crumbs is placed less than 300 quants away from the big door, the warlock will move there, rotate towards the door and then open it.
The warlock will then disappear by diminishing its scale_z value and the player will be able to continue his journey.
The entire code is well commented, so you won't have any problems with it.