Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I want to create a text based game, where the player will type up,down, left or right and the sprite will move in that direction. I created the game and at the moment the player moves with the up,left,down and right keys. I would like to change the movement of the sprite from keypresses to text commands, Ive googled a lot on creating text based games in XNA but have had no luck. Could you please help me or guide me in the right direction of how to do this in XNA.

share|improve this question
2  
What exactly are you asking? Do you want to know how to build a text adventure engine? Because that's what you'll need. –  Hackworth May 31 '12 at 10:17
    
yes that is what i am asking, is it possible to use a normal console in a xna application? –  Sigh-AniDe May 31 '12 at 10:47

3 Answers 3

up vote 2 down vote accepted

If your goal is a text based game your better off making it with regular Form based program, or my favourite WPF. XNA has no built in support for handling typing, that is, quick presses of keys in sequence. It focuses entirely on detecting keys being held over time (which is more likely the case in an action style game). If you really need XNA to display the results as sprites you need to hook into the keyboard events, I would consider WPF some more however if you want a text adventure.

share|improve this answer

If you really want to use XNA and graphics along with your text adventure, you should build your own interface; this should be the least of your challenges since you already seem to know how to display and manipulate graphics with XNA.

The question is, do you want to write a text adventure, or a text adventure engine?

If what you really want is to write a text adventure, you probably should not start by writing a whole new engine. That would be like building your own car if all you want is driving a car.

Writing your own text adventure engine first would not be trivial,I imagine. I would recommend you first try whether an existing engine suits your needs. At least one of those seems to support at least still images for illustration, so they are not text only, which you seem to go for. If you have gathered enough experience with existing systems, you could still write your own engine.

Also highly relevant: this Q&A on Stack Overflow

share|improve this answer

I haven't used XNA, but I have done this at a game jam.

I extended a text box class from an open source GUI library. Whenever the user pressed enter, it cleared the box, checked for a certain keyword/command, and did stuff.

It seems like you can either wrap a XNA game in a WinForm or WPF. If not, there are a few open source GUIs out there.

Possibly helpful question:
http://stackoverflow.com/questions/1561541/xna-and-gui-controls-eg-xaml-and-xna

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.