Wednesday, March 27, 2013

Update 10: Updating the Camera

It became clear to me very quickly that my camera in the isometric view looked a little cheap. Looking at how XCOM implements their camera, I noticed that they did actually use a perspective view, but at an isometric height. Today I switched to a perspective view, which I think really improves things.




I also added a 'killcam', which is a camera directly behind my player. When I shoot at enemies, it now switches to the camera so that you can watch the kill shot and then back again. Pretty simple stuff really, but very effective.



Friday, March 15, 2013

Update 9: Destructible Terrain

As I worked through the shooting mechanics and really got ray casting to work properly, I suddenly found that I couldn't shoot my enemies. I was initially perplexed, but then quickly realized that everything was working perfectly: the shot was hitting the cover (wall) in front of the target. 

It was time to implement destructible terrain.  


Part 1: I aim an the enemy on the far right. He happens to be under cover, so my shot hits the wall in front of him.



Part 2: The wall currently only has a HP of 1, and my laser does 1 HP of damage, so the wall is destroyed. With the wall gone, the enemy is exposed and can be hit easily. In the current prototype, characters have 3 HP, so just 3 more hits from the laser and he will be dead!



Friday, March 1, 2013

Update 8: Randomizing the shooting and adding health (and death)


Now that I had a basic level with shooting from point A to point B, I needed to add some randomization. I personally don't like games of attrition, I prefer games of skill, with some luck.

Enter the random number generator. Basically I pass in 2 numbers, a chance to hit percentage, and a random percentage  The two numbers are compared, if it's a hit, no problem, if it's a miss, I created some random variation so that the shot misses and goes off into the distance.

I spent a bit of time trying to create a random shot until I discovered the Random.insideUnitCircle function. Basically I can multiply a variable against it to have it select a random position around my target, which I then just add to my target position.

Finally, to get everything working, I decided to create a test level. I setup a target, with a wall behind it. It works pretty well and is another item I can cross off the list.