How to restrict clicking on imagebutton once every 3 sec?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
newbiemate
Regular
Posts: 85
Joined: Tue Dec 19, 2017 1:36 pm
Contact:

How to restrict clicking on imagebutton once every 3 sec?

#1 Post by newbiemate »

How can I build an interaction such that an imagebutton cannot be interacted with until 3 seconds has passed after it's been clicked on?

ie, if I have two imagebuttons:

Code: Select all

    imagebutton:
        action Return("Balloon")
        idle "images/balloon.png"
        xpos 100
        ypos 100

    imagebutton:
        action Return("Ball")
        idle "images/ball.png"
        xpos 100
        ypos 100
And the user clicks on Balloon button, then the user can only click on the Balloon button again after 3 seconds. The user can independently click on the Ball button in the meantime, but can't click on the Ball button again after 3 seconds has passed, just like the Balloon.

User avatar
Kia
Eileen-Class Veteran
Posts: 1040
Joined: Fri Aug 01, 2014 7:49 am
Deviantart: KiaAzad
Discord: Kia#6810
Contact:

Re: How to restrict clicking on imagebutton once every 3 sec?

#2 Post by Kia »

define a variable for each and use times with SensitiveIf
https://www.renpy.org/doc/html/screen_a ... ensitiveIf

Post Reply

Who is online

Users browsing this forum: Ocelot