To help in some mental rehabilitation after an unpleasant disaster, I decided to try to learn how to program in Python. So I just started to come up with functions and classes.
I have a main class of enemies that allows me to create such an object.
enemy01=Enemy("Goblin",10,100,2,5,1,2)
To get the name of the enemy, I can use
foe=enemy01.get_enemyName()
My problem is that I want to use the list of enemies that I add when they are killed, and the “against” variable refers to the fact that the enemy is in the game.
So, I tried to create a list of enemy objects, for example
currentEnemy=[enemy01, enemy02, enemy03]
and do
foe=currentEnemy.....
But I can’t figure out how to attach .get_enemyName()
I tried things like this to tie it
foe=(currentEnemy, ".get_enemyName()")
But nothing that I try works when I print "print (foe)", which will be in the main body of the code.
, , , , . , .
, :)