I seem to have a problem with getOneIntersectingObject.
I want to object of a different class to attack each other but I can't seem to get it to work. ( for this I need to get int and that doesn't work )
the code that I'm trieing to use is in BlueSoldier to get ints from redSoldier is
in BlueSoldier :
in RedSoldier
I have tried it with out getters en setters to ( just .statExperiance)
but it didn't seem to work ether.
please help me
int statHealth = 20; //current base maxhealth
int statAttack = 10; //current base maxattatc
int statExperiance = 20; //current experienece
int health; //current health (formula stat * experice)
int attack; //current attact (formula stat * experice)
int statHealthAttacker;
int statAttackAttacker;
int statExperianceAttacker;
int healthAttacker;
int attackAttacker;
boolean moved = false;
boolean attacked = false;
boolean selected = false;
boolean attackMode = false;
boolean controledByPlayer = true;
public void attack() {
statExperianceAttacker = getOneIntersectingObject(SoldierRed.class).getStatExperiance();
int activeEperiance = (int) ((statExperiance *1.5) - statExperianceAttacker);
getOneIntersectingObject(SoldierRed.class).health = getOneIntersectingObject(SoldierRed.class).health - (activeEperiance * statAttatck);
}int statHealth = 20; //current base maxhealth
int statAttack = 10; //current base maxattatc
int statExperiance = 20; //current experienece
int health; //current health (formula stat * experice)
int attack; //current attact (formula stat * experice)
int statHealthAttacker;
int statAttackAttacker;
int statExperianceAttacker;
int healthAttacker;
int attackAttacker;
boolean moved = false;
boolean attacked = false;
boolean selected = false;
boolean attackMode = false;
boolean controledByPlayer = true;
public int getStatExperiance() {
return statExperiance;
}
public void setStatExperiance(int newXp) {
statExperiance = xp;
}

