Stamina bar always visible

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
Lucky-pon
Newbie
Posts: 23
Joined: Mon Apr 22, 2013 5:14 pm
Contact:

Stamina bar always visible

#1 Post by Lucky-pon »

Hi !

So, I have a project in school, and I'm creating a visual novel. In this game, your stamina decreases or increases when you change your location and make choices, and you can have a "Game over" if your stamina reaches 0.

The system works, however, I have a problem : I want the "stamina bar" to always be visible (for example on the top left of the screen), even during choices, dialogues, etc and I haven't found how to do it.

It'll just be text (for now), like for example : "Your stamina = 60"

Thanks in advance if you can help me :3 !!

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

Re: Stamina bar always visible

#2 Post by Alex »

Screens are made for this.
Try

Code: Select all

screen stamina_scr:
    vbox:
        align (0.02, 0.02)
        text "Stamina = [stamina]"
        bar value stamina range max_stamina xmaximum 100

label start:
    $ max_stamina = 100
    $ stamina = 60

    "Let's begin"
    show screen stamina_scr
    "Your stamina is [stamina]"
    menu:
        "Choice 1":
            $ stamina -= 10
            "..."
        "Choice 2":
            $ stamina -= 50
            "... ... ..."
    "?"
http://www.renpy.org/doc/html/index.html
http://www.renpy.org/doc/html/screens.html
http://www.renpy.org/doc/html/style_pro ... properties

User avatar
Lucky-pon
Newbie
Posts: 23
Joined: Mon Apr 22, 2013 5:14 pm
Contact:

Re: Stamina bar always visible

#3 Post by Lucky-pon »

Thanks :)

It works, except the stamina = [stamina] part.

I would like it to be like stamina = 95, is it possible ? Because it showing me exactly the text "stamina = [stamina]"
Attachments
example.png
example.png (11.41 KiB) Viewed 1387 times

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

Re: Stamina bar always visible

#4 Post by Alex »

o_O How did you do this?
What version of Ren'Py do you use? Show the code that gives you the result on the picture, 'cause code works fine for me.

User avatar
Lucky-pon
Newbie
Posts: 23
Joined: Mon Apr 22, 2013 5:14 pm
Contact:

Re: Stamina bar always visible

#5 Post by Lucky-pon »

I'm using the version 6.12.1.1520
Do I need to install it again ? Am I going to lose my scripts if I do that :O ?
Attachments
example.png

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

Re: Stamina bar always visible

#6 Post by Alex »

This version is way too old - a lot has changed. Like the interpolation of variables enclosed in square brackets was added in ver 6.13.
You'd better update the Ren'Py or install latest version as a separate one to use both of them.
If you do, nothing would be lost in your code (everytime you launch your project Ren'Py creates .rpyc files for its own use from your original .rpy files; if the project refusing to run in old version of Ren'Py just delete all .rpyc files - not the .rpy!). But due to changes in Ren'Py you might need to change some of your code.

In your 6.12 try

Code: Select all

text "Stamina = %(stamina)d"
http://www.renpy.org/doc/html/changelog.html#
http://www.renpy.org/doc/html/changelog ... en-py-6-13

User avatar
Lucky-pon
Newbie
Posts: 23
Joined: Mon Apr 22, 2013 5:14 pm
Contact:

Re: Stamina bar always visible

#7 Post by Lucky-pon »

It's working now, thank you a lot :D

Post Reply

Who is online

Users browsing this forum: No registered users