Issues with func naming

Godot Version

4.2.2

Question

Why can I not use 2 functions like func _input(callable): and what solution is there?

And yes, if you are wondering, I am a beginner, I still do not understand coding.

func _input(event):
if event.is_action_pressed(“Space”):
$Label.text = “Woah text”

if event.is_action_released("Space"):
	$Label.text = "no text here"

func _input(event):
if event.is_action_pressed(“R”):
$Label.modulate = Color.RED

if event.is_action_released("R"):
	$Label.modulate = Color.WHITE

try

func _input(event):
    if event.is_action_pressed(“Space”):
        $Label.text = “Woah text”
    if event.is_action_released("R"):
        $Label.modulate = Color.WHITE

It will be:

func _input(event):
    if event.is_action_pressed("Space"):
        $Label.text = “Woah text”
    
    if event.is_action_released("Space"):
    	$Label.text = "no text here"

	if event.is_action_pressed("R"):
	    $Label.modulate = Color.RED
	
	if event.is_action_released("R"):
		$Label.modulate = Color.WHITE

You can’t have two functions of the same name because the engine won’t know which one to run.

1 Like