- Jul 16, 2017
- 9
- 1
Hi, i just wanted to make a simple inventory label and screen with a simple grid, I tried to reproduce some part from lemmasoft.renai.us examples but for some reason it takes me a lot of tries and it did not work.
If anyone could help me with this little project I would be very grateful.
Thanks in advance cheers"!
If anyone could help me with this little project I would be very grateful.
Thanks in advance cheers"!
Python:
init python:
# class
class item():
def __init__(self, name, imag="", cost=0):
self.name = name
self.imag = imag
self.cost = cost
class Inventory():
def __init__(self, money=10):
self.money = money
self.items = []
def add(self, item):
self.items.append(item)
def drop(self, item):
self.items.remove(item)
def buy(self, item):
if self.money >= item.cost:
self.items.append(item)
self.money -= item.cost
# screen
screen Invty:
add "fondos/Invt.png"
modal True
hbox :
grid 5 4:
for item in Inventory:
imagebutton auto "icons/Moc_ico_%s.png" action [Hide("Invty"), Return(None)]
# label
label Inventario:
$ inventory = Inventory()
python:
obj1 = item("objeto1", imagen="icon/obj/icoTest.png", cost=0)
call screen Invty