Hi,
it's a pretty dumb question I guess, but how do I call a method from another class?
I got this method and I want to call it right here:
But as it is in the act method, I can't because it's a non-static method. And if I understood it right, I can't use it because I call on a whole class instead of an actor, but how do I call this method just for one actor?
Thanks guys!
public void bouger()
{
if(etat==1){
posX=plateau.centrer(mouse.getX());
posY=plateau.centrer(mouse.getY());
setLocation(posX, posY);
getWorld().removeObjects(getWorld().getObjects(carreVert.class));
if(isTouching(pionNoir.class)||isTouching(chevalNoir.class)||isTouching(roiNoir.class)||isTouching(tourNoir.class)||isTouching(fouNoir.class)||isTouching(reineNoir.class)){
removeTouching(pionNoir.class);
removeTouching(chevalNoir.class);
removeTouching(tourNoir.class);
removeTouching(roiNoir.class);
removeTouching(reineNoir.class);
removeTouching(fouNoir.class);
}
etat=0;
plateau.changeTour();
plateau.changerJoue();
}
}if(Greenfoot.mouseClicked(this)){
getWorld().removeObjects(getWorld().getObjects(carreVert.class));
chevalBlanc.bouger();
}
