Navigate

Sunday, May 17, 2020

Candles Update #16: Radio

It’s been a while. Lots of “life things”, but also, ever since the prototype was completed, I’ve been a little stuck on how to proceed toward a real product. While there are things happening in the design and narrative aspects behind the scenes, I’m excited to share a script update!

WHAT IT DOES:

The radio will be an object the player can pick up. It will automatically play static when picked up, and stop when dropped.

As the player nears significant objects/areas in the game, the radio may play music, messages, demonic noises–you know, stuff radios tend to pick up.

WHY MAKE THIS:

We need a way to deliver the story and cue the player to explore and experiment. The radio can be an interactive way to do that. Hopefully we can hide clues about the story or objectives within the radio’s audio. Or, if we need, straight up tell the player what to do.

CODE:

image

Here, I set the radio to play audio when it is held and to stop when it is dropped.

The message audio and source transform are assigned by another script. This way, I can use triggers to set what the message audio is. I can also detect how close the player is to the audio source and adjust the volume of both the static and message. I grab the volume of the static and source message as set in editor so they never get louder than needed.

I made a list of game objects, but that was before I was sure how this script would function. So I should probably just delete it and the “AssignRadioScript” function as well.

image
This script holds the secret message audio, volume, and the source location. When the player enters the trigger–it assigns this to the radio’s public variables. If the player leaves the trigger area, then everything is unassigned.

So far it seems to all function pretty well. I look forward to creating some relevant messages/audio to put into the game!