Page 1 of 1

Help Displaying Bar (Where to put code)

Posted: Wed Feb 15, 2017 12:53 am
by SmartAppleGames
hi im having difficulty displaying bars for ui, im not sure where in the code structure to put it. currently the only way to load game is to put it above label start: if i put anywhere after it, i get errors

# The game starts here.

screen sidebar:
frame:
has vbox

bar value stat range 100

label start:

# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.

scene bg room

# This shows a character sprite. A placeholder is used, but you can
# replace it by adding a file named "eileen happy.png" to the images
# directory.

show eileen happy

# These display lines of dialogue.

"Hello, world."

a "You've created a new Ren'Py game."

a "Once you add a story, pictures, and music, you can release it to the world!"

# This ends the game.

return

the above works but no bar is displayed but no errors either.

# The game starts here.

label start:

screen sidebar:
frame:
has vbox

bar value stat range 100

# Show a background. This uses a placeholder by default, but you can
# add a file (named either "bg room.png" or "bg room.jpg") to the
# images directory to show it.

scene bg room

# This shows a character sprite. A placeholder is used, but you can
# replace it by adding a file named "eileen happy.png" to the images
# directory.

show eileen happy

# These display lines of dialogue.

"Hello, world."

a "You've created a new Ren'Py game."

a "Once you add a story, pictures, and music, you can release it to the world!"

# This ends the game.

return

i get the following errors if i put any bar code after label start as seen above

screen sidebar:<- screen expect a non-empty block
frame->: expected statement

all errors, where do i put code so it displays or is did i even code the bar right? help plz im new to ren'py

Re: Help Displaying Bar (Where to put code)

Posted: Wed Feb 15, 2017 1:23 am
by wyverngem
You need to show the screen by using this code

Code: Select all

show screen sidebar
It can be placed in any label. Also you need to define your stat variable.

Code: Select all

default stat = 0

screen sidebar:
    frame:
        has vbox
        bar value stat range 100

label start:
    scene bg room
    show eileen happy
    show screen sidebar
    "Hello, world."
    a "You've created a new Ren'Py game."
    a "Once you add a story, pictures, and music, you can release it to the world!"
return

Re: Help Displaying Bar (Where to put code)

Posted: Wed Feb 15, 2017 1:40 am
by SmartAppleGames
thank you so much it worked! now i can design ui.