コード例 #1
0
ファイル: __init__.py プロジェクト: vinyldarkscratch/Fur
def sync(vers, officialvers, langversneed, title, auth, modules=[], args=[]):
	global version, officialversion, langversneeded, gametitle, author, peltvers, size, width, height, screen, myfont

	version = config.version = vers
	officialversion = config.officialversion = officialvers
	langversneeded = langversneed
	gametitle = config.gametitle = title
	author = config.author = auth
	config.args = args
	
	#from localio import output, newline, getInput, color
	
	#Print the title, author, and version
	makeColor('reset')
	output('author', addon=author)
	output('version', addon=(officialversion, peltvers), s=2)
	newline()
	output('title', addon=gametitle, s=3)
コード例 #2
0
ファイル: gameplay.py プロジェクト: vinyldarkscratch/Fur
def textplay(level):
	playing = True
	makeColor('blue')
	output(level.name, dict=False, s=2)
	makeColor('reset')
	output('gamestart')
	playing=True
	location = level.rooms[0]
	location.describe()
	while playing:
		output("")
		cmnd = getCommand(getInput.text('\n'+m('gameaction')))
		
		# single-word commands
		if not cmnd or cmnd['verb'] == m('quitcmd'): quit(m('quitmsg'))
		elif cmnd['verb'] == m('savecmd'):
			save()
			continue
		elif cmnd['verb'] == m('loadcmd'):
			load()
			continue
		elif cmnd['verb'] == m('helpcmd'):
			output('helpquit')
			output('helpsave')
			output('helpload')
			output('helpdescribe')
			output('helphelp')
			output('helpexamine')
			output('helpeat')
			output('helpdrink')
			output('helptake')
			output('helpgo')
			continue
		elif cmnd['verb'] == m('describecmd'):
			location.describe()
			continue
		
		# two-word commands
		noun = cmnd.get('noun')
		if not noun: continue
		
		if cmnd['verb'] == m('gocmd'):
			roomname = location.go(noun)
			if not roomname: output('doormissing')
			elif roomname == "locked": output('doorlocked')
			elif roomname == "invalid": output('directionerror')
			elif roomname == "Finish": quit('broken4')
			else:
				i = 0
				for r in level.rooms:
					if r.name == roomname: break
					else: i += 1
				location = level.rooms[i]
		else:
			# commands that require an item
			item = location.findItem(noun)
			if not item:
				output('itemerror', addon=noun)
			elif cmnd['verb'] == m('examinecmd') and hasattr(item, 'examine'): item.examine()
			elif cmnd['verb'] == m('eatcmd') and hasattr(item, 'eat'): item.eat()
			elif cmnd['verb'] == m('drinkcmd') and hasattr(item, 'drink'): item.drink()
			elif cmnd['verb'] == m('takecmd') and hasattr(player, 'take'): player.take(item)
			elif cmnd['verb'] == m('opencmd') and hasattr(item, 'open'): item.open(player.inventory)
			else: output('cmderror')