So I've this game with 3 different bonus, which one has his Points. So far I can make the score apper at the top of my game but when the actor intersect with the Object he doesn't count the points....
public class Rolo extends Actor
{
private GreenfootImage image1;
private GreenfootImage image2;
private boolean molhado = false;
private int velocidade;
private int contadorCharco;
private boolean spaceKeyDown = false;
private int xPos = 20;
private int yPos = 117;
private boolean podeSaltar = true;
private int yRestringeDistSalto;
private GreenfootSound saltoSound = new GreenfootSound("salto.WAV");
private int pontos;
public Rolo () {
image1 = new GreenfootImage ("rolo.png");
image2 = new GreenfootImage ("roloTriste.png");
pontos=0;
}
public void touchBonus(){
Bonus bonusganho = (Bonus)getOneIntersectingObject(Bonus.class);
if(bonusganho !=null){
pontos=pontos + bonusganho.getPontuacao();
getWorld().removeObject(bonusganho);
}
}
public void touchStar()
{
Actor touchStar = getOneIntersectingObject(Star.class);
if(touchStar !=null)
{
getWorld().removeObjects(getWorld().getObjects(Star.class));
}
}