Thursday, 19 June 2014

Prototype - Laser Scope

In this post I will create and add laser scope into the weapons so it will be easier to shoot. Another thing will be recoil when our arm is "steady" (when we aren't shooting) 

Laser Particle
I will use this tutorial which is really great! I've created package with everything (material, particle, textures) ready to use here, but you should try to create it by yourself.

Attaching Laser
Go to MyCharacter and create Particle System component with LaserScope FX. It should have disabled AutoActivate.

Add new bool variable into Graph and name it: bLaserScopeEnabled it should be true by default for now.

Now move into ChangeWeapon function. Create Sequence and attach LaserScope Component to MuzzleFlash socket.
Recoil when "steady"
Basically what I want to do is to have zero recoil when I'm aiming. This is really simple as well. I will check if player weren't shooting for X time and then next shoot will have zero recoil. 

Go to MyCharacter and create new floats variables: LastShootTime and ZeroRecoilTime (set to 0.5)

Now in EventGraph go to place where you have your pistol shooting. Before delays set LastShootTime.
Now go to PistolProjectile. And check LastShootTime like here. If it's < then 0.5 we won't be doing any recoil. 
You may be confused why I haven't show anything after Single Trace - it's just a copy of everything below which should be implement by you in earlier posts.

Final result
I won't be showing any video this time because it's hard to see what's happening - you need to play by yourself. Basically when you wait 0.5 seconds before your next shoot you will shoot exactly where the laser is pointing so it's much more easier to aim and create critical strikes now. +1 to gameplay.

In next post I will be adding health bars into enemies.