Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7520037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T01:59:54+00:00 2026-05-30T01:59:54+00:00

Possible Duplicate: Android game rpg inventory system Still stuck on making my rpg in

  • 0

Possible Duplicate:
Android game rpg inventory system

Still stuck on making my rpg in java, there’s one method I don’t know how to implement. Right now, I want to make an inventory checker for the game, like for example it checks how many herbs are in my pack…how many candies I have in my pack and so on.

How can I implement an inventory for my game and how can I show the players what items are in the inventory present?

Is contains method necessary?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T01:59:54+00:00Added an answer on May 30, 2026 at 1:59 am

    I implemented an inventory in my Java game Tyrant many years ago which you might find useful.

    Most of the code is in the “Thing” class, which implement an inventory:

    https://github.com/mikera/tyrant/blob/master/src/main/java/mikera/engine/Thing.java

    Key things to consider:

    • An ArrayList or a single is pretty much all you need in terms of data structure to represent an inventory.
    • You may want to “stack” multiples of the same item into a single item with a count. If you do this then you need to search the inventory for similar items when you add a new Thing, and increment the count if found. You also need all possible inventory objects to implement a “count” property or similar (which is just 1 for single items)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Developing for Android in Eclipse: R.java not generating I have a one
Possible Duplicate: how to change position of Toast in android? Is there any method
Possible Duplicate: Disable back button in android i don't want to dismiss my dialog
Possible Duplicate: Android create shortcuts on the home screen I am having one TextView
Possible Duplicate: Java Synchronization I'm reading the book Beginning Android Games . It uses
Possible Duplicate: Android - Barcode Scanning, Options? Zxing? Android: Is there a way to
Possible Duplicate: Developing for Android in Eclipse: R.java not generating I have imported a
Possible Duplicate: Will Google Android ever support .NET? Is there a way to develop
Possible Duplicate: How to create a file in android? I have a game that
Possible Duplicate: Android - detect whether there is an Internet connection available How to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.