Thursday, April 14, 2011

Farmer Bob's Old Farm Gate Action



Farmer Bob has a new obstaclele to overcome, a very simple one. it's a locked gate that separates Bob's homestead from the old farm area which has the old Barn, abandoned farm house, the old Chicken Coop and disused Silo. Bob will actually need to pick up the key that hanging on his wall in order to get the gate unlocked and then open. Simple I say because I can't really imagine anyone leaving the house, which is the starting point of the game, without taking the key. most people I know explore an area pretty thoroughly before leaving it. At least I always do whenever I'm playing a game. So to miss the key one would have to be pretty blind not to see it hanging there. It is almost because of this very reason that I have thought about perhaps putting the key in the wood shed out back of Farmer Bob's house just so it forces the player to explore a little more. but it to me didn't make much sense to have a key out doors like that??

It took me the better part of almost two day to figure out how to code this to get it to work with a key though. As it's NOT like any of my other door that simply open when the raycast from my FPS player intersects with the door, the door opens. The gate's coding was a little different in that I had to make it recognise that I had actually picked up the key. Took a bit of getting the scripts to send messages to one another, a whole process I'm still a little fuzzy on how it all works. But we eventually got it to work.

The gate model itself didn't really take too long to make, what did take a while was working out the unlocking and gate opening mechanics. The gate has a sort of "Swing Arm" type of locking bracket that closes over the end gate pole and then locks with an old rusty padlock at the ends of the "U" shaped "Swing Arm." I had to make an animation for that part to unlock the padlock, swing the "Swing Arm" down to unlock the gate. You can see the whole thing in action in the video clip from my YouTube. Once you have the key, you approach the gate, press the "Q" key on the keyboard which unlocks the gate, press it again and the gate swings open. A real pain to figure out but at least now I have a working model of this game action so I can use it again if I ever need to in the future.

No comments: