Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Whats the best way to walk around?

 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey everyone! I am trying to create my first game. It is going to be a text based RPG. Right now, i am just trying to figure out a way I can get a player to move around the world. For example on lets say the first move,
would be something like

"you have entered the room"

1. Desk
2. Door on left
3. door to right
4. door behind you

------------------------
Now, if you pressed 1, you would go to the desk and have these options:
----------------------
"you are now at the desk"

1. read note
2. leave desk
-----------------------
and if you pressed 2, you would go BACK to the options:
------------------------------------

"you have entered the room"

1. Desk
2. Door on left
3. door to right
4. door behind you
-----------------------------
And, well, thats how i want the player to be able to move within a limited world. Well, i have already tried numerous ways of doing this. Does anyone have any pointers to a good way to start this off, basic overview of design?
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cool Sean -- I've been working on something similar for a while now so maybe I can help a little.

The example project that is available from the Blue J resources page is good.

I've found that for me a good way to start is to work out what objects are needed
i.e in this case the Desk, Room etc. could all be Places or something similar, and to have a Player or Character object that can move between them. The Place would have references to all of it's neighbouring Places, and would be the object that you would ask where you could move (as the player). Keeping it as simple as possible seems to be the best way to do it.
The BlueJ zork game is an excellent place to start, in my opinion. They have a good system and a parser as well if you were interested in making your game take text commands.

If you have any more questions or just want to bounce some ideas off someone, don't hesitate to post again and I'll see if I can help.

Good luck Sean!
 
ranger
Posts: 17346
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put one foot in front of another? Oh and make sure you are standing.

Sorry, feeling sarcastic this life.

Mark
 
I have a knack for fixing things like this ... um ... sorry ... here is a consilitory tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic