Tutorial on "Status Bars"?

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
VideoGameVet
Newbie
Posts: 23
Joined: Fri Jun 07, 2019 1:03 pm
Skype: william_volk
Contact:

Tutorial on "Status Bars"?

#1 Post by VideoGameVet » Sun Jun 09, 2019 12:54 am

Is there a tutorial on how they do the status bars in a game like "Spirited Hearts". It looks pro and I need stuff like that to indicate Funds, Health, Food etc.
"A delayed game is eventually good, but a rushed game is forever bad."
- Shigeru Miyamoto

User avatar
xavimat
Eileen-Class Veteran
Posts: 1446
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Tutorial on "Status Bars"?

#2 Post by xavimat » Sun Jun 09, 2019 4:46 am

Are you asking about looks or programming?
VideoGameVet wrote:
Sun Jun 09, 2019 12:54 am
It looks pro
It IS pro. https://en.wikipedia.org/wiki/Celso_Riva

You need to learn screen language and put "bars" into a screen. Every bar informs about a variable. (I guess you know what a variable is, if not, feel free to ask).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
VideoGameVet
Newbie
Posts: 23
Joined: Fri Jun 07, 2019 1:03 pm
Skype: william_volk
Contact:

Re: Tutorial on "Status Bars"?

#3 Post by VideoGameVet » Sun Jun 09, 2019 11:43 am

xavimat wrote:
Sun Jun 09, 2019 4:46 am
Are you asking about looks or programming?
VideoGameVet wrote:
Sun Jun 09, 2019 12:54 am
It looks pro
It IS pro. https://en.wikipedia.org/wiki/Celso_Riva

You need to learn screen language and put "bars" into a screen. Every bar informs about a variable. (I guess you know what a variable is, if not, feel free to ask).
Tycoon Games is impressive. Thank you for the suggestion on "screen language".

Until I get somewhere with this, I'll refrain talking about my background :-)
"A delayed game is eventually good, but a rushed game is forever bad."
- Shigeru Miyamoto

User avatar
Per K Grok
Miko-Class Veteran
Posts: 743
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1 & 2
Projects: the Phantom Flier
itch: per-k-grok
Location: Sverige
Contact:

Re: Tutorial on "Status Bars"?

#4 Post by Per K Grok » Sun Jun 09, 2019 2:11 pm

VideoGameVet wrote:
Sun Jun 09, 2019 11:43 am
xavimat wrote:
Sun Jun 09, 2019 4:46 am
Are you asking about looks or programming?
VideoGameVet wrote:
Sun Jun 09, 2019 12:54 am
It looks pro
It IS pro. https://en.wikipedia.org/wiki/Celso_Riva

You need to learn screen language and put "bars" into a screen. Every bar informs about a variable. (I guess you know what a variable is, if not, feel free to ask).
Tycoon Games is impressive. Thank you for the suggestion on "screen language".

Until I get somewhere with this, I'll refrain talking about my background :-)

A very simple way to do a bar that counts down at left mouse button clicks.

Nothing fancy, but it gives the basic elements of one way to do this. :)

Code: Select all

default points=100
screen testLine():
    add Solid("#FF0") pos(10,10) size(points*2,40)

    key "mousedown_1" action [SetVariable('points', points - 1), Show("testLine")]


label start:
    scene bg room
    show screen testLine

    $ renpy.pause(hard=True)

User avatar
xavimat
Eileen-Class Veteran
Posts: 1446
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Tutorial on "Status Bars"?

#5 Post by xavimat » Sun Jun 09, 2019 4:37 pm

If I may... I think Per K Grok's code is not totally correct. :oops:
- It doesn't use a "bar" at all, but creates a rectangle. The "bar" element of screens has a lot of functionality already included, better use that. https://renpy.org/doc/html/screens.html#bar
- It uses a "show screen" and a hard infinite pause that blocks the game. It's really better to use a "call screen"
- It shows again the screen when it shouldn't be necessary.
Try:

Code: Select all

default points = 100
screen test_line():
    bar value points range 100
    key "mousedown_1" action SetVariable('points', points - 1)
    textbutton "Exit" action Return()

label start:
    call screen test_line
    return
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
VideoGameVet
Newbie
Posts: 23
Joined: Fri Jun 07, 2019 1:03 pm
Skype: william_volk
Contact:

Re: Tutorial on "Status Bars"?

#6 Post by VideoGameVet » Sun Jun 09, 2019 5:58 pm

Thank you for your help. Very useful.
"A delayed game is eventually good, but a rushed game is forever bad."
- Shigeru Miyamoto

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]