The frame is not showing >_<

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
Sehaf
Regular
Posts: 58
Joined: Thu Feb 25, 2010 9:22 pm
Projects: Demon Lord & Yuki Academy
Deviantart: Sehad
Location: Sweden
Contact:

The frame is not showing >_<

#1 Post by Sehaf »

So, after almost a months without a hitch of programing i finaly stumble into a block, but not the programing part per say, but the art one.
What I try to do is to have my picture as a background for the HP bar. in my game but nothing happens. it only gives a standard ugly blu box insted of my image.

code is as following;

Code: Select all

    style.my_bar = Style(style.default)
    style.my_bar.xalign = 0.5
    style.my_bar.xmaximum = 315 # bar width
    style.my_bar.ymaximum = 30 # bar height
    style.my_bar.left_gutter = 5
    style.my_bar.right_gutter = 5
    style.my_bar.background = Frame("",10,10)

    style.my_bar.left_bar = Frame("ui/bar_full.png", 0, 0)
    style.my_bar.right_bar = Frame("ui/bar_empty.png", 0, 0)
    style.my_bar.hover_left_bar = Frame("ui/bar_hover.png", 0, 0)

Code: Select all

        if show_playerHP:
            ui.frame(
                xpos = 10, #centered
                ypos = 10,) #10 px Down from the Top
            
            ui.vbox(xalign = 0.5)
            ui.text ("Player HP: %d" %HP, 
                xalign = 0.5)
            ui.text ("Re rolls: %d" %re_roll, 
                xalign = 0.8)
            ui.bar(max_HP, HP, 
                style="my_bar")
            
            ui.close()
            
The red line of HP souse is showin as intended, but not the actuall Frame
which makes me all kinds of sad... >_<
Is there perhaps someone who could help me past this silly stage? (explanations helps me not doing it again as well ^_^)
I'm a GameMaker!
My Portfolio: http://www.bluepipestudio.com

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: The frame is not showing >_<

#2 Post by namastaii »

What I do is I don't use frame.
I write it like this:

Code: Select all

    style.my_bar.left_bar = "ui/bar_full.png"
    style.my_bar.right_bar = "ui/bar_empty.png"
    style.my_bar.hover_left_bar = "ui/bar_hover.png"
and if you need to set the max and minimum size:

Code: Select all

    style.my_bar.ymaximum = 50 
    style.my_bar.xmaximum = 250
with whatever numbers you need obviously.

Also, you're using the more outdated code. (the ui. stuff)
So you should just simply make a screen with the bar something like this in this format:

Code: Select all


    bar range HP_max value HP style my_bar

--- this version is more updated:

Code: Select all


            frame:
                xpos 10 #centered
                ypos 10 #10 px Down from the Top
            
                vbox xalign 0.5:
                    text "Player HP: [HP]" xalign 0.5
                    text "Re rolls: [re_roll]" xalign 0.8
                    bar range HP_max value HP style "my_bar"
            

User avatar
Sehaf
Regular
Posts: 58
Joined: Thu Feb 25, 2010 9:22 pm
Projects: Demon Lord & Yuki Academy
Deviantart: Sehad
Location: Sweden
Contact:

Re: The frame is not showing >_<

#3 Post by Sehaf »

So many thanks for the respons, though in the end, I re-did it somewhat with screens instead. Though this lsolved one thing I had problem with ^_^ Domo!
I'm a GameMaker!
My Portfolio: http://www.bluepipestudio.com

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], piinkpuddiin