About 'Nightvision Mode'!

In this video (objectives)…

1 Set up Nightvision 2 Use an Enum to list possible vision modes 3 Use call_group() to change vision modes

After watching (learning outcomes)…

Enable nightvision mode through enums and the amazing power of groups!

(Unique Video Reference: 15_HM_GDT)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

I have a problem with the sfx of nightvision as it is in the lecture.

In the “Nightvision Mode” section, you proposed loading the stream from disk every time you want to play it, and that makes the sound “late”.

The solution is to load the sfx in the _ready function, so setting the stream and stating playing is instantaneous.

For example, my code in VisionMode.gd is as follows:

extends CanvasModulate

const VISION_DARK=Color("504279")
const VISION_NIGHTVISION=Color("65a47e")

var nightvision_on_sfx=load(Global.nightvision_on_sfx)
var nightvision_off_sfx=load(Global.nightvision_off_sfx)

func _ready():
    add_to_group("interface")
    set_vision_dark()

func set_vision_dark():
    color=VISION_DARK
    play(nightvision_off_sfx)

func set_vision_nightvision():
    color=VISION_NIGHTVISION
    play(nightvision_on_sfx)

func play(streamdata):
    $AudioStreamPlayer.stream=streamdata
    $AudioStreamPlayer.play()

Privacy & Terms