Adding Lights and Flashlight In Zombie Runner

We did a pretty basic implementation of lights, but the flashlight system will be a really cool feature. Do you have any questions or anything to share?

2 Likes

Did a few things. Created this cabin with pro builder and the pro grid. Added point lights with some free assets from the store.I like it haha

3 Likes

I love the idea of the frog! Waiting to try it.

1 Like

I implemented a flashlight before this video so I was very keen to see if I ended up doing same thing as in video… and I did not :slight_smile:

What I did was I basically created a new weapon with weapon script attached to it. Just made it to look like a flashlight and put some lights on it. Put range, damage etc to 0 because obviously you can’t harm enemies with flashlight (well actually, let’s not go into that :smiley: )

That worked until this point where decaying mechanism had to be implemented. What I ended up doing first of all I created new ammo type of Battery. Then instead of using Weapon script I made a new script BatteryWeapon that inherits from Weapon. Then I just basically had to override Shoot method and some other stuff as well as extend BatteryWeapon class so that it suits our needs. So when ever you switch to flashlight it starts “shooting” automatically and will use battery ammo. In next video what I think I need to do is just create a new ammo pickup variant and set its ammo type to battery and that should work.

How I’d like to finish this course right now but it’s already well past midnight so one more day :slight_smile: Been a great time and looking forward learning more.

PS. I explained my solution briefly on purpose. If any of you would like to hear more then I’m happy to share.

PSS. Oh and of course one fundamental difference is that in my game player has to choose between weapon or flashlight. I might implement some sort of dual wielding if I feel like it.

2 Likes

If anyone runs into this error, “Copying assembly from ‘Temp/Assembly-CSharp.dll’ to ‘Library/ScriptAssemblies/Assembly-CSharp.dll’ failed.” Go into your antivirus software and exclude your repo folder from being scanned.

1 Like

I like how this is coming along. :smiley:

Dungeon%20Raid%203

1 Like

some lights weren’t working well but in the lectures Q&A I was able to solve the issue. I made the lights render ‘important’ instead of the default ‘auto’. Now all lights emit as expected. The level is becoming more atmospheric now. [edit] excuse the steam notification at 0:05 mark. It occurred while I was recording ^^.

Hi Rick!

You are awesome. You taught to program two years back and I still enjoy watching your tutorials even now as a software developer.

Great job!
H

Thanks for saying that, I’m glad things are going well for you!

1 Like

I didn’t really want a battery mechanic but I did want some flickering and fading intermittently for flavour. It took some nested coroutines and some lerping but I did get it to work. Here’s a video of how it looks:

Privacy & Terms