I would like to add all variables that use the items
class to a list without adding each item manually to a list each time i create a new item.
For example itemsList = [flower, wood, iron, sticks]
flower = items(red, "flower", "0001",xpositions[0] ,ypositions[0])
wood = items(brown, "wood", "0002",xpositions[1] ,ypositions[1])
iron = items(iron, "iron", "0003",xpositions[2] ,ypositions[2])
sticks = items(brown, "sticks", "0004",xpositions[3] ,ypositions[3])
itemsList = []
code for the class
class items:
def __init__(self, colour, name, ID, xpos, ypos):
self.width = 20
self.height = 20
self.colour = colour
self.name = name
self.ID = ID
self.xpos = xpos
self.ypos = ypos