All Questions

Community

D
moowool

Function _set_speed undefined ?

In this chapter, _set_speed setter is not defined, and is causing an error in my game. Is the function defined in another chapter ?
  • Nathan Lovato replied

    I just checked and it's not included because it doesn't do anything for you, as a student. We use it to update the flame sprites behind the ship. I'll update this to remove the setter in the next update. Here's the code

    func _set_speed(value: float) -> void:
    	_speed = value
    
    	var speed_ratio := Vector2.ONE * _speed/SPEED_MAX
    	_flame_main.scale = speed_ratio
    	_flame_left.scale = speed_ratio * 0.35
    	_flame_right.scale = speed_ratio * 0.35
    

    Note, as you can see, this is not a step-by-step tutorial or a course with chapters. The idea is we focus on showing you what's important to understand how this mechanic or use case work, and try to remove all the surrounding noise.

    Anyway thanks for the heads up, this needs some tweaking.