Create a cooldown on a button

I’m trying to create a FNAF game in Wick Editor and everything is going fine other than the buttons.

I’ve created a Mouseenter button and that means the moment the mouse enters the button, it goes to a different scene.

The problem is: Whenever you hover on a button, it sometimes jump-cuts to a different scene.
And what I want is the code to add a delay to the buttons

Welcome to the forums.

From what I understand you want to add a delay to some buttons that change the frame when the mouse enters them, unless it is something else that I not getting.

This is a little example project that uses a timer so that the mouse must hover over the button for a certain amount of time before you change frames.
hoverButton2-16-2022_15-56-05.wick (2.2 KB)

In essence you can make a delay with something like this,

In the default script of a clip

this.timer = 0; // this variable will count the frames passed

Then in update, or the script in which the timer should update

this.timer++; // increment it by one per frame
if (this.timer >= 20) { // you can replace 20 with how many frames you want it to wait
    gotoAndStop(2); // you can then do something like switch frames
}

Sorry if I said something wrong but what I want is a timer where the moment you enter a frame, the timer starts and prevents you from pressing the button (E.g. You can’t press the button until the timer ends the moment you enter a frame to prevent jumpcutting.) (The timer should also play even if the mouse is outside the button.)

Here is an example where once you click a button you goto a different frame and then must wait 2 seconds (by default but you can change the window.timeToWait = 60; to a different number) before you can click another button to go to another frame.

wait2-17-2022_11-28-30.wick (3.6 KB)

1 Like