Jump to content
  • Advertisement

Rick281

Member
  • Content Count

    15
  • Joined

  • Last visited

Community Reputation

146 Neutral

About Rick281

  • Rank
    Member
  1. Rick281

    Is there an easier way?

    Ok I like the concept that Fell said about using a data base, but I am totally lost as to where to start. Some questions that I have about it would be, How do I make the data base?, Where do I put the data base? How would I use the information from the data base to make an object? Sorry for my inexperience, but I am only trying to learn.
  2. Ok so for those of you who don't know I am in the process of making a very small console based pokemon clone in java. While coding today I ran across a question and figured that I should ask it here and maybe I'll learn something new. (My goal is to learn at least one new detail about Java everyday). Anyways, I was beginning to hard code some stuff like pokemon moves, stats, etc. and wondered if there was a better way of doing it all. Currently, I am really just using the name of the pokemon in a switch to determine which moves it has. It is really a lot of work for just one pokemon and I got to thinking how someone would do this for lets say 100 pokemon. Not that I plan to do 100 pokemon, I am just wondering if there are more efficient concepts behind stuff like his. Thanks in advance!! 
  3. Rick281

    Need pointed in the right direction

    Big thanks for the arraylist and collections!! I'll be reading up on them and seeing what I can do. Thanks everyone!
  4. Ok so I am trying to create a console version of pokemon in java. I have made some really good progress, but find myself stuck on creating and storing multiple pokemon objects inside the player party and in-game computer storage. Like in what way could I create these pokemon objects to allow another pokemon object to be created when the player catches another pokemon and to allow the player to move the pokemon objects around in their party, computer, etc. I know that this may be complex and that there is no "right" way of doing this, I just really need pointed in the right direction. So far the only possibility that I have come up with is to create an array of pokemon objects with a length of owned pokemon, but I see many flaws in this idea. I'm not sure how I would initialize each of the objects and am afriad that each time the number of owned pokemon increases, an entire new array would be created. I also have no idea how I would allow the player to move around the pokemon from the party and computer with the array concept. Any type of advice is appreciated! 
  5. So I am wondering if what I did here is something that is bad or if the java garbage collector will take care of it on its own. I have two different methods below and I have taken out all irrelevant code to simplify things. I create a scanner in each method. Usually I would close the scanners to get rid of the memory leak warning, however, when I close the first scanner, I was unable to use the second. I found a solution that said just don't close the scanners and it works fine, but I am wondering if this is dangerous to do. Thanks in advance! static String menu(){   String menuoption; Scanner menuscanner = new Scanner(System.in);   menuoption = menuscanner.next();   return menuoption;   }// end of menu method     static void info(){   Scanner infoscanner = new Scanner(System.in);   infoscanner.next();   }//end of info method  
  6. Ok so for those of you that want to see very messed up code, I am putting my four classes on here. Any and all tips are welcome!   Here is my game class: package Game; import java.util.Scanner;   public class Game {    public static void main(String[] args){ boolean running = true; String gamestate = "menu"; Scanner scanner = new Scanner(System.in); Player player = new Player();     while (running == true){   switch(gamestate){ case "menu" :     System.out.println("Menu--------------------------------"); System.out.println("1) Play"); System.out.println("2) Info"); System.out.println("3) Exit");   String menuoption = scanner.next();   switch(menuoption){   case "1" : gamestate = "introduction";   break;   case "2" : gamestate = "info";   break;   case "3" : running = false;   break; }//end of menuoption switch   break;//end of menu     case "info" :   System.out.println("Developed by Brock Grinstead"); System.out.println("Version: 0.0.3"); System.out.println("Enter anything to return to the menu"); scanner.next(); gamestate = "menu";   break;//end of info   case "introduction" :   Setup gamesetup = new Setup(); gamesetup.setupMap();   String playername; String player_action;   System.out.println("Entering the world of consolemon...");   System.out.println("What is your name?"); playername = scanner.next();   player.setName(playername);   System.out.println("Hello " + player.getName()); System.out.println("Welcome to the world of consolemon!!"); System.out.println("This is a very different world from the one that you know."); System.out.println("You will have to learn how to coexist with many different consolemon and trainers."); System.out.println("A great adventure awaits you, Goodluck!!");   player.setLocation("Sloan Town");       gamestate = "worldmap";       break;//end of introduction   case "worldmap" :     System.out.println("What would you like to do?");   player_action = scanner.next(); player.Playeraction(player_action);           break;// end of world map } }// end of game loop     scanner.close(); }// end of program     } Here is my map class package Game;   public class Map {   private String mapname; private String maptype;     public void setMapname(String nameofmap){ mapname = nameofmap; }   public String getMapname(){ return mapname; }   public void setMaptype(String typeofmap){ maptype = typeofmap; }   public String getMaptype(){ return maptype; }   static void Mapdescription(String currentmap){     switch(currentmap){   case "Sloan Town" :   System.out.println("Sloan Town is the town that you first find yourself in the world of consolemon.");   break;//End of Sloan Town     }//End of map description switch      }//End of map description method   }   Here is my player class package Game;   public class Player {   private String name; private String location;   public void setName(String enteredname){ name = enteredname; }   public String getName(){ return name; }   public void setLocation(String playerlocation){ location = playerlocation; }   public String getLocation(){ return location; }     void Playeraction(String paction){   switch(paction){   case "Map Info":   Map.Mapdescription(location);     break;//end of map info     }//end of player action switch     }// end of player action method   }// end of Player class   and here is my setup class package Game;   public class Setup {   void setupMap(){   Map map1 = new Map(); map1.setMapname("Sloan Town"); map1.setMaptype("town");   }   } I apologize for any head aches.
  7. I will try. I'm programming in Java. I am currently using eclipse to program and compile in. I am wanting to create a console type game that resembles pokemon. I know it is probably a difficult goal for me but I want to challenge myself. So the concept is that the player will start in one map and will have a list of actions to do on each map, such as walk this way, get map information, etc. This is really what I am focussing on right now. I really haven't put much thought into how battles and leveling and such is going to work yet. I am just trying to do one thing at a time. So far I have four classes : Game, Map, Player, Setup. The game class is where the program starts and contains the game loop which is a gamestate while loop. The map class will contain information such as the map name, map type, which creatures are in the map, how big it is, etc. The map class also has a method to give information when the player wants to know the information. The player class contains the location of the player, player name, etc. It has a method where the game loop will ask for an action to be typed in and will do whatever has been entered. The setup class is just there to hold all of the map construction and such. If it is easier to upload my eclipse project I can in a new topic. I'm really new to programming and I know I am probably doing 90% of stuff in a terrible way, but I am just trying to learn some of the concepts for game design. Thanks so much.
  8. Ok thanks everyone for replying to me. I got some good information and I'll be going back to try to rethink things. Hopefully I can put together some type of solution. If not, I'm sure I'll be back.
  9. Thanks for the reply, although the language is a bit advanced for me. As to why the player is called in the map class is because some of the map methods are going to depend on the location of the player (which map the player is in). So i need to call the player.getLocation() method inside the map class. Forgive me if this is a silly way to do this I am very new to programming in general.
  10. So in my program i have a Game class that contains the game loop and such, a Map class for map objects, and a Player class to create the player object. The player is created in the Game class and I am able to use the player methods just fine in that class. However, in my Map class, I am wanting to use the player.getLocation() method, but it gives me the error that player cannot be resolved. Do I need to create my player object in a different place or somehow make the player object public or something. Thanks for the help!
  11. Rick281

    Where to include map data etc.

    Yes, I suppose this is true. I guess a better question would be if this is a logical way to attempt to do this. If it doesn't seem logical I would really rather spend another day researching instead of programming a nice chunk only to realize that it isn't going to work many days in the future. But anyways I think I will give it a shot. Thanks for the help guys and you will probably be seeing me again on here. :p
  12. Rick281

    Where to include map data etc.

    So are you saying to make a class that includes methods to build all of my objects? Like a class called Setup that has methods like Setup.maps(); and so forth? If this is the right way of going about this, then should all of these methods be called as soon as the player selects play from the menu?
  13. Ok so I am currently in the process of learning java and my game that I am making is all console based, meaning no graphics are involved. I was kind of turned off by the idea of just a text adventure or guess the word game, so I am trying to make a game that might be kind of fun to play. The best way to describe it would be a console version of pokemon. I know this is challenging for a beginner, but I want to challenge myself and learn java at the same time. So my question is where should I include all of the information for my map objects. I have a map class that includes the name, type, etc. but I am not sure as to where I need to setup all of my maps if the player is going to be able to go back and forth between maps. I hope this question makes sense and thank you for any help you can give me!
  14. Rick281

    Help with my next step

    Wow thanks guys the links are great and should keep me busy for some time. I'll be sure to bookmark them!!!! Thanks again
  15. Hello everyone, I'm pretty new to these forums here at gamedev.net. I'm currently trying to learn java and plan to start coding games as a personal hobby.  I have been reading Head First Java for some time now and i was wondering what my next step in learning would be. I'm really wanting to start in 2d stuff like pong or some type of shooter and maybe a side-scroller later on, but I need to know where I can learn more about graphics, game loops, game physics, AI, etc. I know its a pretty broad topic, but I'm just a bit lost at the moment and wanting some advice. Thanks for any input!!
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!