How to set a fixed shader Diffuse(Color) in gdscript

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lavaduder
:warning: Old Version Published before Godot 3 was released.

So I have a fixed shader, and I want it’s color to change when I do something. (Like hit key I or something.) However Fixed_Material doesn’t have a set_diffuse function.

So how does one change the Diffuse Color in gdscript.

Here’s what I’ve done so far.

func _ready():
	shader = FixedMaterial.new()
	FixedMaterial.new().???
	set_material_override(shader)
:bust_in_silhouette: Reply From: mollusca

Use set_parameter with PARAM_DIFFUSE. For example:

func _ready():
    var material = FixedMaterial.new()
    material.set_parameter(FixedMaterial.PARAM_DIFFUSE, Color(1.0, 0.0, 0.0))
    set_material_override(material)

Check the FixedMaterial docs for more parameters.