I’ve made quite a bit of progress with my GameJam game this week. Admittedly I’ve had to have a lot of help to get this thing up and running and I’ve made it through a blue screen of death but through all that, I have something that I can call my own. Its bare, its basic and I’ve already thought of a million ways (not actually a million) to improve it, but I’m proud of it nonetheless. so, whats been happening then?
First off I’ve added code to the guards for their line of sight. Currently the script to make this happen looks the above picture but the important part of it is what’s shown below.
This section of the script tells the guards to be on the lookout for the burglar and to patrol their routes. They’re constantly looking for the burglar so as long as he says out of their line of sight the chasing component stays false and their normal component stays true. This means they’ll stick to their patrols. However, if they get sight of the burglar, the normal component returns a false value which kicks in the chase component turning it true. This makes the guards actively look at the burglar and fires their guns.
And above is the script associated with the firing of the gun. If the bullet hits the burglar, then the game is instantly restarted. When I left it last lesson the guards were trigger happy shooting at anything and everything. The above code fixed all of that. And they’re red for testing purposes – if they’re red then they can’t see the burglar but when they could, they turned green.
I’ve also added in something to collect too. Scattered around the level is money;
In a rich man’s world.
The burglar has to collect these money packs to be able to complete the level and there’s five of them scattered around. Each money pack has been tagged within Unity as ‘Money’ so Unity knows that these will be pickups for the player to collect and below is the scripting to make this happen. Instead of actually picking the money up and since there’s no inventory system needed in this game, each money pack had been assigned a destroy object command when the burglar touches it. It simulates the pickup but that’s it.
Each guard now has his own waypoint which is detailed below complete with their own line of sight, view distance and torchlight. And all are on shoot to kill orders!
Finally below is a GIF of the level being played for your viewing pleasure.
So what would I like to improve? Well, a goal for starters. In my rush to get it finished, and up until last night I thought I had, I realised I forgot to add in the exit. The idea was to have the burglar make his (or her, I haven’t decided yet) way to the exit area and once in it, then the game would end. There’d also be a restart game button/menu too for when you get shot. I’d maybe like to re-draw the assets to make them look more like I was thinking of then at the start but I think that’s down to practice – I need more of it when drawing out and creating the assets in the first place. I’d also like the guards to chase the burglar a little instead of just standing there and also be a little more intelligent in doing so too but I feel like that’s some fairly advanced stuff right there an easily waaaaaay out of anything I could do.
But anyway, that’s something for another day.