I've been thinking recently about how cool it would be to make a rpg/text adventure game where you could fight monsters- in my case fallout3 inspired mutant hicks from the game point lookout. I have the room classes. (I can give code later in the day). how would i make a weapons class, monster class, etc for the rpg elements of the game?

Luckily, i found a post on a battle system so thats out of the way. Like i said, is there a way to make a list of weapons and monsters and append those weapons you can pick up and the monsters/hicks to a room class?

Recommended Answers

All 3 Replies

Yes, you make a Monster class, and a Weapons class, and in the constructor of the Room make a list of the monsters and a list of the weapons.

Yes, you make a Monster class, and a Weapons class, and in the constructor of the Room make a list of the monsters and a list of the weapons.

thanks MathaxOr

Here's some of the code that I had given you last time with a few modifications.

class Room:
 
	def __init__(self,argDesc,argDir,argMon,argPrz):
		self.desc = argDesc
		self.dir = argDir
		self.monsters = argMon
		self.prizes = argPrz

	def narrarate(self):
		print self.desc
 
	def goTo(self, argWhere):
		if self.dir.has_key(argWhere) == 0:
			return None
		else:
			return self.dir[argWhere]

closet = []
closet.append(Room("You enter the closet", \
{"south":bedroom}, \
[Monster("boogie_man"), Monster("boogie_man")], \
[Weapon("Generic Sword")]))
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.