Hello,
I am new to these forums, so I apologize ahead of time if these things have been posted here before. I've done a search for both of these, and found nothing that answered my question.
First I will give you a brief description of the project that I am working on so you may possibly be able to start thinking of possible ways to do what I am trying to figure out. Also, please not I am kind of a beginner at programming, I've been doing basics since I was 12, but am now just taking formal classes which explains everything.
I am creating a Text based RPG game using NetBeans IDE 6.9 and using BreezySwing GUI. The game is a one(1) player turn based RPG where the player has these basic stats:
private String[] playerStatName = {"HP", "Atk", "Str", "Def", "Agi", "Int", "Prayer"}; private int[] playerStatExp = {1154, 0, 0, 0, 0, 0, 0}; private int[] playerStatLevel = {10, 1, 1, 1, 1, 1, 1};
I do not have everything created that the player will have, such as weapons, armor, and potions, but these will all be stored in their game save as well. Now, onto my questions.
I've never done this before, but I've read a few things that gave me an idea on how to make a game save fine such as save1.dat, but I have no idea how to make the flat file.
I would like this game save to store the player name, player combat level, player stats, stat levels, and stat experience, along with their inventory, and their rights. Player Rights are either 1 or 0, 1 being administrator, 0 being normal player, this will be determined by a certain username that is entered when you create a new game.
Now, I would like the game save to look something like this
------------
//Player Basics
Username: (store username here)
Combat: (store combat level here)
//Player Stats
Hitpoints: (store hitpoint experience here) (store hitpoint level here)
Attack: (store attack experience here) (store attack level here)
Strength: (store strength experience here) (store strength level here)
Defense: (store defense experience here) (store defense level here)
Agility: (store agility experience here) (store agility level here)
Intelligence: (store intelligence experience here) (store intelligence level here)
Prayer: (store prayer experience here) (store prayer level here)
//Player Inventory
Beadys: (store amount of beadys here)
there would be something for weapons here
there would be something for armor here
and something for potions here
------------
I do not yet have weapons, armor, or potions made, but if I see how the other stuff is done, once I have them created I can probably figure out how to add them into the file.
So, what I need to know is how would I be able to save the game so the player can close the game, and then later re-open the game and load the game save.
Here is how the game will be saved and loaded
private JMenuItem saveGame, newGame, loadGame public void menuItemSelected(JMenuItem menu){ if(menu == saveGame){ what code would I put here so that it saves the data for the player that is stored in the Player.java?? } if(menu == loadGame){ what code would I put here so that it reads and loads the data from the saved game? } }
That is my basic question. I hope I explained it correctly, and thoroughly so that you all can understand what I am asking properly.
Also, I apologize for the extremely long post.
Now, my second concern is this. I have a JMenuItem shop; also. And I have a Shop.java where it has the GUI stuff declared.
Right now I have it set, in the Shop.java
this.setUndecorated(true);
and
this.setResizable(false);
this way the minimize, maximize, and close buttons do not show up, and you cannot move the shop, or change the size.
As of right now I have the shop window popping up on top of the general GUI that has the players HUD and
general game options, and what I want is that the player has NO way of minimizing this window, because
I do not want the player to be able to have the shop open and fight a monster at the same time, this giving
them the ability to buy the health potions in the middle of the fight.
My question on this topic is, is it possible to some how hide the shop window from the taskbar so they cannot
use that as a means to minimize the shop window?
If there is, how do I go about doing this?
Thank you all for reading this, and I appreciate any answers I get on these topics, and I'm always willing to take extra information
on how to do things better than I already am.
And again, I apologize for such a long post, I am just trying to be as thorough as I possibly can to avoid having to post replies back
to people explaining things in more detail.