How to make a timed clicker [Solved]

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
justsam
Newbie
Posts: 10
Joined: Fri Dec 03, 2021 4:33 pm
itch: launcher
Contact:

How to make a timed clicker [Solved]

#1 Post by justsam »

I wanted to make a mini clicker game inside my game so the game won't progress further until you complete the small clicker. I managed to make it (sorry if the code is longer and uglier than necessary I just started coding for RenPy this week), but I was wondering if there was a way to make it timed so if they didn't click fast enough it would jump back to the previous image. So like if they're on ghost_idle3 and they don't click within a second, it'd jump to ghost2. But if they did click it within a second, it'd jump to ghost4.

Here's my code right now:

Code: Select all

screen ghost_idle1():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost1_%s.png" action Jump ("ghost2")

screen ghost_idle2():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost2_%s.png" action Jump ("ghost3")

screen ghost_idle3():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost3_%s.png" action Jump ("ghost4")

screen ghost_idle4():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost4_%s.png" action Jump ("ghost5")

screen ghost_idle5():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost5_%s.png" action Jump ("ghost6")

screen ghost_idle6():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost6_%s.png" action Jump ("ghost7")

screen ghost_idle7():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost7_%s.png" action Jump ("ghost8")

screen ghost_idle8():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost8_%s.png" action Jump ("ghost9")

screen ghost_idle9():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost9_%s.png" action Jump ("ghost10")

screen ghost_idle10():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost10_%s.png" action Jump ("ghost11")

screen ghost_idle11():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost_%s.png" action Jump ("possessed")

label ghost2:
    call screen ghost_idle2()

label ghost3:
    call screen ghost_idle3()

label ghost4:
    call screen ghost_idle4()

label ghost5:
    call screen ghost_idle5()

label ghost6:
    call screen ghost_idle6()

label ghost7:
    call screen ghost_idle7()

label ghost8:
    call screen ghost_idle8()

label ghost9:
    call screen ghost_idle9()

label ghost10:
    call screen ghost_idle10()
    
label ghost11:
    call screen ghost_idle11()
Last edited by justsam on Fri Dec 03, 2021 8:15 pm, edited 1 time in total.

User avatar
zmook
Veteran
Posts: 421
Joined: Wed Aug 26, 2020 6:44 pm
Contact:

Re: How to make a timed clicker

#2 Post by zmook »

justsam wrote: Fri Dec 03, 2021 5:21 pm if they're on ghost_idle3 and they don't click within a second, it'd jump to ghost2. But if they did click it within a second, it'd jump to ghost4.
Try this:

Code: Select all

screen ghost_idle3():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost3_%s.png" action Jump ("ghost4")
  timer 1.0 action Jump("ghost2")
colin r
➔ if you're an artist and need a bit of help coding your game, feel free to send me a PM

justsam
Newbie
Posts: 10
Joined: Fri Dec 03, 2021 4:33 pm
itch: launcher
Contact:

Re: How to make a timed clicker

#3 Post by justsam »

zmook wrote: Fri Dec 03, 2021 6:16 pm
justsam wrote: Fri Dec 03, 2021 5:21 pm if they're on ghost_idle3 and they don't click within a second, it'd jump to ghost2. But if they did click it within a second, it'd jump to ghost4.
Try this:

Code: Select all

screen ghost_idle3():
  vbox xalign .50 yalign .50:
    imagebutton auto "Ghost3_%s.png" action Jump ("ghost4")
  timer 1.0 action Jump("ghost2")
It worked! Thank you! :)

Post Reply

Who is online

Users browsing this forum: Google [Bot], henne