Text Based Dungeon Escape Game!

Text Based Dungeon Escape Game!

Postby KoreanCookie » Sun Apr 20, 2014 5:50 am

Hi there! I'm new to the forum and I'll quickly introduce myself before I explain what I wish to say. I'm a Korean 13 year old male, and I recently got into programming and I want to start improving my Python coding skills! Please review what I have completed so far on my new project, a text based Dungeon Escape game!

I just started this project like a half an hour ago and I think I have an idea of how I want it to work. I think I'm finished with the basic template for my items and character. Please tell me what I did wrong and what I can improve on!
[EDIT] I will implement health tomorrow, it's almost midnight at the time I'm typing this down...
Code: Select all
class Room:
    def __init__(self, name, desc, exits, id):
        self.name = name
        self.desc = desc
        self.exits = exits #[N, S, W, E]
        self.objects = objects
        self.id = id
class Ability:
    def __init__(self, name, physDamage, magDamage, physResist, magResist, desc, id):
        self.name = name
        self.physDamage = physDamage
        self.magDamage = magDamage
        self.physResist = physResist
        self.magResist = magResist
        self.desc = desc
        self.id = id
class Enemy:
    def __init__(self, name, ability1, ability2, physPower, magPower, physResist, magResist, weapons, desc, id):
        self.name = name
        self.ability1 = ability1
        self.ability2 = ability2
        self.physPower = physPower
        self.magPower = magPower
        self.physResist = physResist
        self.magResist = magResist
        self.weapons = weapons
        self.desc = desc
        self.id = id
class Weapon:
    def __init__(self, name, physDamage, magDamage, desc, id):
        self.name = name
        self.physDamage = physDamage
        self.magDamage = magDamage
        self.desc = desc
        self.id = id
class Resistance:
    def __init__(self, name, physResist, magResist, desc, id):
        self.name = name
        self.physResist = physResist
        self.magResist = magResist
        self.desc = desc
        self.id = id

#Abilities (sw = sword, b = bow, d = dagger, sh = shield, sp = spell)
swSlash = Ability("Sword Slash", 10, 0, 0, 0, "The most basic sword move", 1000)
swParry = Ability("Sword Parry", 7, 0, 15, 0, "The basis for all sorts of parries", 1001)
#Rooms#
prisonRoom1 = Room("Prison Cell 1", "Like the rest of the cells, this one contains very few objects", [0, 0, 1, 0], 2000)
#Weapons#
dagger = Weapon("Dagger", 4, 0, 0, 3000)
#Enemies#
cellGuard = Enemy("Cell Guard", swSlash, swParry, 10, 0, 10, 0, "These guards patrol the hallways of the dungeon", 4000)
#Resistance#
clothArmor = Resistance("Cloth Armor", 3, 0, "A thin layer of cloth enough to keep you from dying", 5001)

playerName = ""
playerLevel = 0
playerExp = 0
playerGold = 0
Last edited by Mekire on Sun Apr 20, 2014 8:31 am, edited 1 time in total.
Reason: First post lock.
KoreanCookie
 
Posts: 3
Joined: Sun Apr 20, 2014 5:45 am

Re: Text Based Dungeon Escape Game!

Postby Mekire » Sun Apr 20, 2014 7:44 am

Well it is a little too early to really make any real comments.

There are some superficial things you should change before you get too deep though I guess:
  • Ditch the self.id attribute; You don't need it. If you want to put the item in dictionaries or something similar use the item name. The name has an actual meaning. The id number is just something unnecessary to remember.
  • Your naming conventions do not follow standard python practice. We do not use mixedCase variable names in Python. Give this a read over for all of the common naming conventions.
  • Try to avoid numbered variable names. Usually when you feel you need numbered variables, what you actually need is a list.

-Mek
User avatar
Mekire
 
Posts: 976
Joined: Thu Feb 07, 2013 11:33 pm
Location: Amakusa, Japan


Return to Game Development

Who is online

Users browsing this forum: Google [Bot] and 12 guests

cron