• 0

    posted a message on What is your school schedule? Or if you're an adult, what is your schedule for the day?
    1. Physics
    2. PE
    3. Chemistry
    4. Lunch
    5. Mandarin
    6. English
    7. World History
    8. Algebra I + Geometry

    or

    1. Logic
    2. PE
    3. Biology
    4. Lunch
    5. Study Hall
    6. Physics
    7. English
    8. World History
    9. Algebra I + Geometry
    Posted in: General Off Topic
  • 0

    posted a message on Java game inventory?
    Ok. Sillen is right though. I've been learning Java while I've been making the game. Guess I should focus more on java and less on the actual game. Thanks for the help guys!
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    The game I'm working on isn't much like minecraft, I just used that as an example for the inventory. It's kind of like this game actually. Well, it's in that game in the aspect of gameplay, content is different.

    EDIT: What would I do since it's a 2D top down game? Since I can't exactly use camera and all.
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Cool! Thanks Baggerboot!

    I'm not exactly sure what to put in the Item class though. Could I have another example please? =)

    Also, is the getInventorySize method the size of one slot or the whole thing?
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Quote from Satharis

    Make an item class, make a player class, make the player class contain an array of inventory slots or something. Create methods that add/remove/sort those slots, things like that. Make the visual inventory read each item existing in the array and display it accordingly. It really depends on a lot of factors about how the gameplay works and how your inventory is.


    Thanks for that overview!

    Do you think that you could give me an example please? I know enough java to get by, but for something like this I'm not really sure how I would go by it.
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Quote from Satharis

    It's rather vague what you're asking.. what part don't you understand?


    Well most of the inventory system really. At the moment I really have no idea how to pick the item up, and how to place the item into inventory slots.
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Hmm I tried it and it didn't work, the player just walks right over it...

    Player.java
    public Rectangle getBounds()
    {
    return new Rectangle(x, y, getPlayerImg().getWidth(null), getPlayerImg().getHeight(null));
    }
    
    public void checkCollisions()
    {
    ArrayList<ItemStick> sticks = GameFrame.getStickList();
    
    for(int i = 0; i < sticks.size(); i++)
    {
    ItemStick tempStick = sticks.get(i);
    if(getBounds().intersects(tempStick.getBounds()))
    {
    JOptionPane.showMessageDialog(null, "You picked up a stick");
    }
    }
    }


    I tried System.out.println but it didn't work either, so I just replaced it with JOptionPane

    GameFrame.java
    static ArrayList<ItemStick> sticks = new ArrayList<ItemStick>();
    public static ArrayList<ItemStick> getStickList()
    {
    return sticks;
    }


    ItemStick.java
    public Rectangle getBounds()
    {
      return new Rectangle(x, y, getStickImg().getWidth(null), getStickImg().getHeight(null));
    }


    That's just the code that applies, there's more stuff in between.
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Hmm, what would you use to check for collisions? Because what I normally use needs an array and I think that's kind of redundant for a stick. :P Or should I just make the array?
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    What do you mean print out?

    I'll pm you the src.
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Hmmmm... well I'm not sure if this works, but I just drew one to the screen. I'm not sure what to do from this point.

    (Pardon my noobiness, I'm relatively new to all this.)
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Well at the moment I don't have any code for the inventory yet and I haven't gotten far enough to acquire items. I was hoping that once I got the inventory figured out I could just go from there. Lemme go make an item :P
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Quote from Rainfur

    Not sure what your question is....

    It'd help if it was on github. :)

    You get lots of help there.


    What I meant was this:

    I just can't seem to figure out how to make an inventory. Something similar to minecraft's is fine, but instead if pressing a button for the inventory window to pop up. To the right of the actual game is where a whole bunch of tiles are, and that's where you place your items.

    Does that help?
    Posted in: Computer Science and Technology
  • 0

    posted a message on Java game inventory?
    Hello!

    I've been making a top-down 2D rpg game with java and I've made some good progress, but I'm not sure how I should make an inventory system? I've tried using things from my own knowledge and I can't seem to find any tutorials. I have it so that you always see the inventory on the right of the window. Can somebody please help?
    Posted in: Computer Science and Technology
  • 0

    posted a message on Help please!
    I added a new NPC to my mod. I added the code, a texture, a model all that stuff. But when I find one, this is what they look like:



    When I use techne and load a texture to it it's perfect, but not in Minecraft.

    Somebody help please! D:
    Posted in: Mods Discussion
  • 0

    posted a message on Custom Buildings
    Does anybody know?
    Posted in: Mods Discussion
  • To post a comment, please or register a new account.