How to start a mouse click countdown on my screen?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Syl

Greets!

I’d like to change scene once the defined number of click on the screen has been reached. What would be the script for that please?

:bust_in_silhouette: Reply From: njamster
var clicks = 0
const REQUIRED_CLICKS = 5

func _input(event):
	if event is InputEventMouseButton:
		if event.button_index == BUTTON_LEFT and event.pressed:
			clicks += 1
			if clicks == 5:
				get_tree().change_scene("res://PathToScene.tscn")

Cheers mate! :slight_smile:

Syl | 2020-02-02 16:54