Thank you for visiting Blazing Games

Thought Police

In order for this game to play fairly, the cops had to be consistent with how they behaved. I really banged my head over how to deal with the cops until I decided to take a break and play some games for an hour or so. While deciding which game I wanted to play, I started thinking about classic arcade games. I then started thinking about a certain game where you had to eat a bunch of dots on the screen while being chased. I then remembered that the particular game I was thinking about had the creatures chasing you following paths until they spotted you and then those creatures would chase you. Such a technique would work great for my problem. The twist here, of course, was that I needed a path that would allow the player to reach the end of the map without being spotted.

Sometimes, working from the destination and working your way back to the beginning is the best way of solving a problem. So, I worked out the path that the player would have to travel and then based on that map was able to figure out where the cops had to be placed for that map to work. The paths that the cops would take had to be stored, but the easiest way of doing this was just to place turning information right on the map data.

The actual logic for the cop is fairly simple. Check to see if the player is in the line of site. If so, chase the player (and radio the cop near the docks). If not, see if the tile ahead is a turn marker. If it is, make a turn otherwise keep moving forward. For those of you who don't want to open up the source file, the code to handle the cop logic is below.

Previous page
Chapter 9 Page 5

About - Privacy Policy - Contact - Links - FAQ
Copyright © 2006 Blazing Games Inc. All Rights Reserved