How can I count how many times i press the button so that it'll change to a different scene that time?

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

I want the scene to change when I press the button 15 times to let’s say, the credits.

you can add a counter. :slight_smile:

SDGN16 | 2021-02-22 20:31

thank you for this information
i have to extend it otherwise godot wont publish my reply

sirmuffin | 2021-02-22 21:26

:bust_in_silhouette: Reply From: xCode Soul

Something like this

counter = 0

func on_button_pressed:
counter = counter +1

If counter == 15:
       # do something here ex: change your scene