Page 1 of 1

Tutorial on "Status Bars"?

Posted: Sun Jun 09, 2019 12:54 am
by VideoGameVet
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.

Re: Tutorial on "Status Bars"?

Posted: Sun Jun 09, 2019 4:46 am
by xavimat
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).

Re: Tutorial on "Status Bars"?

Posted: Sun Jun 09, 2019 11:43 am
by VideoGameVet
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 :-)

Re: Tutorial on "Status Bars"?

Posted: Sun Jun 09, 2019 2:11 pm
by Per K Grok
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)

Re: Tutorial on "Status Bars"?

Posted: Sun Jun 09, 2019 4:37 pm
by xavimat
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

Re: Tutorial on "Status Bars"?

Posted: Sun Jun 09, 2019 5:58 pm
by VideoGameVet
Thank you for your help. Very useful.