How to make a clicker game?

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
User avatar
Yukari
Regular
Posts: 123
Joined: Sun Feb 06, 2011 6:28 am
Completed: Aozora Meikyuu, Yozora Rhapsody, Imolicious, Yume Puzzle, Apprehend;Girlfriend
Projects: Games&Girls, Fuyuzora Rumble
Organization: Yume Creations
Tumblr: yumecreationsvn
Location: Germany
Contact:

How to make a clicker game?

#1 Post by Yukari »

I thing it should be possible to make a clicker game with renpy.
How can I click on a specific area on the screen and the click are counted?
Image

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: How to make a clicker game?

#2 Post by IrinaLazareva »

4 Example:

Code: Select all

default points=10
default plus=2
default max_point=30
default clicked = True

screen clicker:
    modal True
    timer .5 repeat True action [If(points <= 0, true=Jump("lost"), false=SetVariable("points", points - plus))]
    button:
        text "[points] / [max_point]" size 40
        background "#000"
        xpos .5
        ypos .5
        xysize(300, 300)
        action [SetVariable("clicked", True), If(points >= max_point, true=Jump("win"), false=SetVariable("points", points + plus))]
    vbar value StaticValue(points, max_point)

label start:
    centered "Get Ready!{w=1}{nw}"
    call screen clicker
label win:
    $ renpy.pause(2, hard=True)
    centered "Winner"
    return
label lost:
    centered "Lost"
    return

User avatar
Yukari
Regular
Posts: 123
Joined: Sun Feb 06, 2011 6:28 am
Completed: Aozora Meikyuu, Yozora Rhapsody, Imolicious, Yume Puzzle, Apprehend;Girlfriend
Projects: Games&Girls, Fuyuzora Rumble
Organization: Yume Creations
Tumblr: yumecreationsvn
Location: Germany
Contact:

Re: How to make a clicker game?

#3 Post by Yukari »

Thanks this works smoothly ^^
How can I show a sprite which changes expression when clicked and play a sound?
Image

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: How to make a clicker game?

#4 Post by IrinaLazareva »

something like this

Code: Select all

default points=10
default plus=2
default max_point=30
default clicked = True

init:
    image happy = "happy.png"
    image neitr = "neitral.png"
    image sadd = "sad.png"
screen clicker:
    modal True
    timer .5 repeat True action [If(points <= 0, true=Jump("lost"), false=SetVariable("points", points - plus))]
    button:
        text "[points] / [max_point]" size 40
        background "#000"
        xpos .5
        ypos .5
        xysize(300, 300)
        action [SetVariable("clicked", True), If(points >= max_point, true=Jump("win"), false=SetVariable("points", points + plus)), Play("sound", "click.ogg")] #add click.ogg file to 'game' folder
    if points>=20:
        add "happy" xalign .3 yalign 1.0
    elif points<10:
        add "sadd" xalign .3 yalign 1.0
    else:
        add "neitr" xalign .3 yalign 1.0    

timdonehy200
Newbie
Posts: 20
Joined: Sun Mar 12, 2017 6:15 am
Deviantart: timdonehy200
Contact:

Re: How to make a clicker game?

#5 Post by timdonehy200 »

I love the idea of a clicker game in ren'py and managed to implement it using the expertise in this thread.
However, now that I have an animation on a loop which can be clicked on, I would like to add some music on a loop in the background of the ogv file, but I have failed to achieve this. Wherever I put a code line to play music, it either fails to play it or stops the clicker game from launching (while the movie plays in a constant loop). Here is my code, could someone be kind enough to let me know where to include a line to play music as a background of the movie used as a clicker game if possible at all?

Code: Select all

label clickergame:

    play movie "clickergame.ogv" loop
    show movie with fade
    centered "Click at the center!{w=1}{nw}"
    call screen clicker1

    screen clicker1:
        modal True
        timer .25 repeat True action [If(points <= 0, true=Jump("lost"), false=SetVariable("points", points - plus))]
        button:
            xpos .3
            ypos .1
            xysize(300, 500)
            action [SetVariable("clicked", True), If(points >= max_point, true=Jump("win"), false=SetVariable("points", points + plus))]
        bar value StaticValue(points, max_point):
        xalign 0.45 yalign 0.0
        xmaximum 400 
        ymaximum 15

label win:
    stop movie
    me "I win"
    jump wherever1

label lost:
    stop movie
    me "I lose"
    jump wherever2

ocimpean
Newbie
Posts: 24
Joined: Tue Aug 27, 2013 9:13 pm
Location: Florida
Contact:

Re: How to make a clicker game?

#6 Post by ocimpean »

I wonder how to have an animation that cycle itself instead of static files that change only when 'points >= number'?
***Edit: I figure it out.***

Post Reply

Who is online

Users browsing this forum: No registered users