Implementing flashlight

Today I learned how to implement a flashlight into my Unity game. I had to start again, so the room is basic, but I’m going to improve that now. To add the flashlight, I made a spotlight, made it a child of the FirstPersonCharacter, and then wrote code so that pressing the ‘F’ key would toggle the flashlight on and off. I also added animation to the door using iTween that makes it slowly rotate open over 5 seconds.

I had problems starting off, because I accidentally saved my level in the local drive, and today I was stuck in a different seat, so I just had to start again. I had a couple of problems trying to add code I had already implemented, but it was just accidentally missed semi colons for the most part.

I like the door animation I added, I think it makes it more interesting, however I’m really not fond of the level, so I am going to work on how the level looks, and make some of my own 3D models for next time.

Flashlight.png

Advertisements

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