RSS

GAM 111.3 Reflective Development Logbook Blog 6 (Week 7)

03 Nov

Study Week!

No uni classes this week and all assessments have been completed and submitted. So what is there to talk about this week?

We’ll how about how I’ve partly transformed the first player shooter we had been working on in class into a zombie survival?!

OH FEENIKXFIRE YES PLEASE!“.

That’s what I thought too guys,

ice_screenshot_20151127-121231

So in the previous version of the shooter allowed the game to start with the player equip with an AK74u with an infinite amount of re-loadable ammo, well not any more! Not only does the player have a certain amount of ammo to use, reloading has full functionality. Reloading with any amount of ammo left in the clip or in reserve ammo calculates correctly.

For something that seems so simple, figuring it out for the first time is a little bit of a head-scratcher, in terms of it working correctly.


At first i thought it would be simple enough to stick with the two variables that had already been set up that track the current amount of ammo in the clip (and the new variable I made for reserve ammo). But that proved to be too difficult, it worked perfectly for the 50 percent of reloading. But when it came to reload when the reserve ammo is less than clip size but the clip is half empty, reserve ammo would fall into negative numbers in order to restore the current ammo to the maximum clip size.

So I decided to add a third variable that would track the amount of shots that have been fired. Whenever a shot was fired, the number tracking variable was incremented by 1. Whenever the player reloaded, the shots fired number tracking variable was reset to 0.

This ended up being the code (nestled in among many other lines of code)  that works perfectly –

//Refill current ammo with maxclipsize
player.reserveAmmo -= shotsFired;
player.currentAmmo += shotsFired;
shotsFired = 0;
if (shotsFired >= player.reserveAmmo)
{
shotsFired = player.reserveAmmo;
player.currentAmmo += player.reserveAmmo;
player.reserveAmmo -= shotsFired;
shotsFired = 0;
}

– The reserve ammo is decreased by the amount of shots fired.

– The current ammo is increased by the amount of shots fired.

– The shots fired variable is set to zero.

– If shots fired is greater than or equal to the players reserve ammo.

– The amount of shots fired will never be greater than the reserve ammo (stops it from going under zero).

– The remaining reserve ammo is added to the current ammo.

– The reserve ammo is subtracted by the amount of shots fired (which has been capped at the amount of reserve ammo left)

– The shots fired variable is set to zero.


Along with full functionality of reloading, enemies now have the appearance of a zombie, with some walking animations and a zombie groaning sound. The zombie asset pack that I have imported from the unity store came with quite a few animations, but I’m not sure how to use multiple animations or make certain animations play when certain things happen. So for now the zombies are just in a constant walking state until I shoot them to their death.

I’ve also added a way for enemies to drop little squares (ammo) that when the player comes into contact with them it will give the player reserve ammo. But the way that the player controller has been set up seems to interfere with the collision detection between the player coming into contact with objects which results in not being able to collect ammo at all.

Other than that, I have expanded the play field, added a building with a ramp onto a roof and re-baked the navmesh agent on the enemies to recognize all of the addition objects they need to navigate.

This weeks song:

Until next time –

FeenikxFire

Nic

 

Image source:

Lyness, N. (2015). Zombie New Layout Screenshot. Retrieved from https://feenikxfire.wordpress.com 

Lyness, N. (2015). FPS Shooter Ammo Screenshot (1). Retrieved from https://feenikxfire.wordpress.com/

Lyness, N. (2015). FPS Shooter Ammo Screenshot (2). Retrieved from https://feenikxfire.wordpress.com/

 

Video source:

Tenacious D – Tribute. (2010). Retrieved from https://www.youtube.com/watch?v=_lK4cX5xGiQ

Advertisements
 
Leave a comment

Posted by on November 3, 2015 in Uncategorized

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: