I'm trying to make a game with enemies that spawn consistently. I've done something like this in the past but used the exec("enemy%s = Enemy()" % x)
command to consistently create instances of a class. I was wondering if there are any more effective ways to do this. Please link me to a duplicate if there are any as I couldn't find any.
I've tried
virus = {virus0 : Virus()}
for x in range(1, 11):
virus.append((virus : Virus()) % x)
but this returned invalid syntax. I don't know how to correctly do this with a dictionary nor list.