@trooper6 The folder structure goes from game to images to items to my image (candybar.png)
@Alex, I tried stretching the background and all it did was make my image look distorted and larger (and the items didn't show up either)
I also changed my names so that there would be no overlapping names and that still hasn't worked
Inventory Help
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.
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.
-
- Newbie
- Posts: 14
- Joined: Mon Jun 18, 2018 9:15 pm
- Contact:
Re: Inventory Help
Hm, could you make a sample project with all images and inventory code and share it to let people try to find solution?
-
- Newbie
- Posts: 14
- Joined: Mon Jun 18, 2018 9:15 pm
- Contact:
Re: Inventory Help
Here's the sample file, hopefully you'd be able to fix it!
- Attachments
-
- Inventory_Help.rar
- (1.55 MiB) Downloaded 21 times
Re: Inventory Help
Well, you've deleted the "side "c r":" line...
It must be
Also, try to change your "inventory_screen.png" to have just a frame (without slots). Then make a separate slot background image and use it like
It must be
Code: Select all
vbox:
pos (363, 0.05) anchor (0.0, 0.0)
#### inventory slots
frame:
background Frame("images/inventory_screen.png", 1, 1) #file name including path from game folder (if needed)
side "c r":
# size of the inventory visible area
area (0, 0, inv_item_width*inv_cols+inv_spacing*(inv_cols-1), inv_item_height*inv_rows+inv_spacing*(inv_rows-1))
viewport id "vp":
draggable True
Code: Select all
for item in inventory:
button:
background Frame("images/inventory_slot.png", 1, 1)
xysize(inv_item_width, inv_item_height)
#### Choose one option and delete the other:
# 2) show an image
add item["img"] align (0.5, 0.5)
-
- Newbie
- Posts: 14
- Joined: Mon Jun 18, 2018 9:15 pm
- Contact:
Re: Inventory Help
Thank you so much for your help! It works perfectly as I would want it to be! Do you think you could tell me if there was a way to offset the background image or the area of the grid/inventory and also how do I get rid of the slider that's in frame (This is for sure my last question)
Re: Inventory Help
Was a bit busy - real life, you know...
Try something like
Try something like
Code: Select all
screen onscreeen_button():
imagebutton idle "inventory" hover "inventory_hovered" xpos 1080 ypos 66 action If(not renpy.get_screen("inventory_scr"), Show("inventory_scr"), Hide("inventory_scr"))
screen inventory_scr():
modal True
imagebutton idle "inventory" hover "inventory_hovered" xpos 1080 ypos 66 action If(not renpy.get_screen("inventory_scr"), Show("inventory_scr"), Hide("inventory_scr"))
default description = None
vbox:
pos (363, 0.05) anchor (0.0, 0.0)
#### inventory slots
frame:
background Frame("images/inventory_screen.png", 1, 1) #file name including path from game folder (if needed)
side "tl c":
# size of the inventory visible area
area (0, 0, inv_item_width*inv_cols+inv_spacing*(inv_cols-1)+inv_offset*2, inv_item_height*inv_rows+inv_spacing*(inv_rows-1)+inv_offset*2)
null width inv_offset height inv_offset
viewport id "vp":
draggable True
mousewheel True
grid inv_cols max(inv_rows, len(inventory)/inv_cols+1) spacing inv_spacing:
for item in inventory:
button:
xysize(inv_item_width, inv_item_height)
background Frame(Solid("#c0c"), 1, 1) # <--- put image for the frame
# 2) show an image
add item["img"] align (0.5, 0.5)
text item["name"] align (0.5, 0.95) # if needed
action NullAction()
hovered SetScreenVariable("description",item["dscrptn"])
unhovered SetScreenVariable("description",None)
# empty slots to fill the grid
if len(inventory) < inv_cols*inv_rows:
for i in range (inv_cols*inv_rows-len(inventory)):
button:
xysize(inv_item_width, inv_item_height)
background Frame(Solid("#c0c"), 1, 1) # <--- put image for the frame
action NullAction()
else:
for i in range ((len(inventory)/inv_cols+1)*inv_cols-len(inventory)):
button:
xysize(inv_item_width, inv_item_height)
background Frame(Solid("#c0c"), 1, 1) # <--- put image for the frame
action NullAction()
#vbar value YScrollValue("vp") # comment or delete this line if not need the scrollbar
#### description
if description:
text "{i}[description]{/i}" size 25 xalign 0.5
else:
null
# something about our inventory...
define inv_cols = 3
define inv_rows = 3
define inv_item_width = 143
define inv_item_height = 143
define inv_spacing = 36
define inv_offset = 72
Who is online
Users browsing this forum: Andredron