'm new to Java and please try to explain to me. I am developing a game using slick2d and I'm making so called a shop.class and a player.class The shop class should add medkits to the player class. I have been making so many test on it even testing if it adds on other int(In player.class)

package javagame;

import org.lwjgl.input.Mouse;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;

public class _civ {

    //civillian ship ID
    public int civShipID = 1001;

     * default numbers
    //Civ num
    public int civ = 20;
    public int civLimit = 100;
    //civillian population
    public int currentPop = 30;
    //items per civ
    public int itemPer_civ = 2;

    //item numbers and type
    public int items = 5;
    public int itemsStock = items * itemPer_civ;
    //player buys / default 0
    public int player_buy = 0;

    //items in stock

    //number of civ selling med kit
    public int medKitCiv = 3;

    //stock of the medkits
    public int medKitStock = medKitCiv * itemPer_civ;
    //how much (Money)
    public int medKitMoney = 20;

    //player med kit requested
    public int medKitRequest = 0;
    //if invalid number of stock (Means that not enough stocks)
    public boolean moreStocks = false;

    _player player = new _player();
    public void worldRender()   
        //this method would render it to its specific state. 
    public void player_Buy(int num,Input input)
        //this is to test if this would add
    public void test()


package javagame;

import org.newdawn.slick.Input;

public class _player {

    //player money 
    public int money = 1000;

    //inventory items 
    //1 box = items stock

    public int boxes = 10;
    //box for purpose
    public int reservedBox = 5;
    //box available 
    public int availableBox = boxes-reservedBox;
    //each boxes number can be stored
    public int itemsStock = 5;
    //number that can be stacked altogether of the boxes
    public int itemsStocks = boxes * itemsStock;
    //reduce items
    public int currentItemNum = 0;

    //health and others

    public int SHIP_HEALTH_HULL = 100;

    public int SHIP_DAMAGE_ENEMY = 0;

    public int SHIP_HEALTH_SHEILDS = 30;

    //extra health
    public int medKitStock;
    //add Health per medKit
    public int medKitAddHealth = 10;
    public int medKitReg = medKitStock * medKitAddHealth;

    public void inventory(Input input)



In main class which ouputs everything. This are the things called form my main class:

Re: Why can't external class add another external class? 80 80

You haven't had any answers yet. That's probably because the question is too vague. Try to explain exactly what you are trying to do, what code you have tried, what error messages you have got etc.

Re: Why can't external class add another external class? 80 80

at where you got the error???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.