"""File that starts the game"""
import Classes
import Functions
#Space for imports
PlayerRace = input("What race are you? ")
PlayerName = input("What is your name? ")
Player = Character(PlayerName, PlayerRace, 25, 1)
This imports this code with the class in it:
"""File with all classes"""
import Variables
class Inventory(object):
def __init__(self, name, size):
self.name = name
self.size = size
contents = {}
def add_item(self, item, inventory):
inventory.append(item)
addedtext = item + " recieved!"
print addedtext
def remove_item(self, item, inventory):
if item in inventory:
inventory.remove(item)
removeitem = item + " removed!"
print removeitem
class Organism(object):
def __init__(self, name, species, extra_health, extra_damage):
self.name = name
self.species = species
self.health = 25 + extra_health
self.damage = 1 + extra_damage
isdead = False
def dead(self, name, health):
if self.health <= 0:
isdead = True
return True
elif self.health > 0:
isdead = False
return False
class Enemy(Organism):
def __init__(self, name, species, extra_health, extra_damage):
self.name = name
self.species = species
self.health = 25 + extra_health
self.damage = 1 + extra_damage
class Character(Organism):
def __init__(self, name, species, extra_health, extra_damage):
self.name = name
self.species = species
self.health = 25
self.damage = 1 + extra_damage
MaxHealth = 50
The error I get is this:
Traceback (most recent call last):
File "/home/ubuntu/workspace/python/Main.py", line 9, in <module>
Player = Character(PlayerName, PlayerRace, 25, 1)
NameError: name 'Character' is not defined
So can someone tell what went wrong and what to do to solve this problem?

New Topic/Question
Reply


MultiQuote



|