I've got 4 .py files that I'm using for a basic text based game. Unfortunately, I can't figure out why an attribute is not carrying all the way through like I'd expect.
This method of assigning enemies is fairly round-about, but it's all because of the rest of my game logic.
Here's my code:
characters.py
class Enemy():
def __init__(self, name):
self.hit = 0
enemies.py
from characters import Enemy
class Zombie(Enemy):
def __init__(self):
self.name = "zombie"
selectors.py
import enemies
def enemysel():
return enemies.Zombie()
game.py
import selectors
test = selectors.enemysel()
print(test.hit)
When I run game.py, I just keep getting this error:
AttributeError: 'Zombie' object has no attribute 'hit'
What am I doing wrong?