I'm trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.
I created a class Toy and want to create a function, getNewToy(name, data1, data2, data3, data4, data5).
I want this function to create a new instance of the class Toy, and I want the function to be able to be called multiple times each time creating a new instance.
In my experience you create an instance with:
class Toy:
def __init__(self, name, data1, data2, data3, data4, data5):
pass
myToy = Toy(myToy, 1, 2, 3, 4, 5)
then to use methods from the class with:
myToy.method1()
Seeing as I want to have the ability to have multiple toys, each with a playWith() method I want the instance to reflect the name of the Toy each time one is called.
I want the instance to be different each time I call the method getNewToy(,...) and the instance to reflect the name.