As you see, my code does not work. When armor1 is true, it would add my life. goldA is another class.
public void goldenArmor(GameContainer gc, StateBasedGame sbg, Graphics g)
{
if(armor1==true)
{
goldA.life = life;
goldA.intelligence = intelligence;
goldA.power = power;
goldA.lifeLeft = lifeLeft;
goldA.head();
goldA.body();
goldA.legs();
}
}
My other class:
package javagame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
/*
Note: Copyright(C)2012 System Networks | Square NET | Julius Bryan Gambe. You cannot copy the style, story of the game and gameplay!
To programmers: The int,doubles,strings,booleans are properly sorted out. Please don't mess it up.
*/
/*
NOTE: We have loops but not for programming. The loop is:
1.show the world to user
2.Obtain input from the user
3.Shows the update, repeat step 1
*/
import org.newdawn.slick.*;
import org.newdawn.slick.state.*;
import org.lwjgl.input.Mouse;
//contents:
//
public class GoldenArmor{
//get it from play
public int life;
public double intelligence;
public int lifeLeft;
public double power;
public GoldenArmor() {
// TODO Auto-generated constructor stub
}
//start here
public void head()
{
life += 10;
intelligence +=0.5;
}
public void body()
{
lifeLeft += 100;
}
public void legs()
{
power += 100;
}
}
/*
SYSTEM NETWORKS(C) 2012 NET FRONT
*/
The life, intelligence, power, lifeLeft are nothing but to use it as just reference to prevent stack overflow. And at my main class, it becomes my real booleans, int, doubles. How do I fix this? It does not add it to my normal int.