timeday

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
elproxxgamer
Newbie
Posts: 9
Joined: Sun Aug 11, 2019 9:53 pm
itch: renpytom
Contact:

timeday

#1 Post by elproxxgamer » Thu Dec 26, 2019 5:01 pm

Hi, I'm new to Renpy. I wanted to know if someone can help me make my days go by, by night and by clicking on a bed, and showing the days you go.

User avatar
Alex
Lemma-Class Veteran
Posts: 2602
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: timeday

#2 Post by Alex » Thu Dec 26, 2019 6:43 pm

Kind of example...

Code: Select all

default days_spent = 0
default can_click = False
define me = Character("Me")

image white:
    Solid("#fff")
    size (150, 150)
    
image blue:
    Solid("#00f")
    size (450, 150)

screen days_scr():
    frame:
        align (0.05, 0.05)
        vbox:
            spacing 10
            text "~~~~~~~~~~"
            text "Days spent - [days_spent]"
            text "~~~~~~~~~~"
            
screen bed_scr():
    button:
        align (0.5, 0.5)
        hbox:
            add "white"
            add "blue"
        action Jump("sleep_time")
        sensitive can_click

# The game starts here.

label start:
    "..."
    show screen bed_scr with dissolve
    "... ..."
    show screen days_scr with dissolve
    
    $ can_click = True
    
    label game_loop:
        if days_spent < 4:
            me "I woke up..."
            label loop_1:
                me "It's so dark around..."
                me "I hardly see the bed."
                "~ search some around ~"
                me "Oh, there's nothing else here but this bed."
                jump loop_1
        elif days_spent < 7:
            me "I woke up..."
            label loop_2:
                me "Yeah, hello darkness..."
                me "...hello, bed."
                "~ no unswer ~"
                me "Am I going crazy?..."
                jump loop_2
        else:
            $ can_click = False
            me "I woke up..."
            "Is it sunday already ?!!!11"
            "the end."
    return
    
label sleep_time:
    $ can_click = False
    "Got to sleep some..."
    hide screen bed_scr with dissolve
    "ZzzZzzZzzz..."
    $ days_spent += 1
    show screen bed_scr with dissolve
    $ can_click = True
    jump game_loop
https://www.renpy.org/doc/html/python.html
https://www.renpy.org/doc/html/label.html
https://www.renpy.org/doc/html/screens.html
https://www.renpy.org/doc/html/screen_actions.html

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], kyngocthienan, Majestic-12 [Bot], m_from_space