Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About JNewt

  • Rank
  1. JNewt

    making a text based rpg. need help.

    *WARNING: NON-TECHNICAL EXPLANATION IMMINENT!* You can think of an array as a bunch of variables that you can call by the same name. Say you had an array called 'Names': Names[0]="Jeff"; Names[1]="Justin"; Names[2]="John"; ...etc.. You could reference these names by doing this: myName=Names[1] This is alot easier than declaring lots of different vars (Name1, Name2, Name3...) and can be vital when using loops. Assuming that you had filled the Names array up with various names, you could print them out like this: for (j=0, j==50, j++) { write Names[j] } It gets better! You can two (or more!)-dimensional arrays. Think of a grid like the game Battleship; at the coordinates B7 there might be a ship or a piece of data. Rooms[0,0]="The Kitchen"; Rooms[0,1]="The Den"; Rooms[1,1]="The Library"; You can create a Room class and fill each 'cell' in the array with an instance of the Room (loaded with data that you can read from a file, of course). Then you simply need to track the player's current X, Y coordinates and display information about the Room at that location.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!