Python 3 - OOP Tutorial - simple RPG, proceeding where the course ended | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Python 3 - OOP Tutorial - simple RPG, proceeding where the course ended

Hey Folks, I tried to build up on what the Object Oriented Programming lesson gave us with the simple RPG. https://code.sololearn.com/cEe96ILTtVPm/#py I'm kind of stuck now though - how can I create multiple instances of the subclass Goblin now? Iterating through GameObject.objects will always just have one object Goblin, right? Help me out here, I'm lost with OOP.

15th Mar 2018, 8:16 AM
Thilo Gebhardt
Thilo Gebhardt - avatar
1 Answer
+ 4
I didn’t check your whole code, but writing: class Goblin(Enemy): pass gob1 = Goblin() gob2 = Goblin() (or a similar thing) should instantiate multiple goblins.
15th Mar 2018, 11:18 AM
Pedro Demingos
Pedro Demingos - avatar