I know this has been overdone but i'm still haven't found exactly what I needed. I have looked at the asteroid tutorial but it hasn't helped me.
i have a class (Frog) which needs to access a boolean variable (direction) from another class (Log). How do i go about doing this?
I have used the following code but it says in the Frog Class: cannot find symbol - method getDirection()
public class Log extends Actor
{
public boolean direction = true;
public void act()
{
if (direction = true) {
direction = false;
}
else {
direction = true;
}
}
public boolean getDirection()
{
return direction;
}
public class Frog extends Actor
{
public void checkCollision()
{
int x=getX();
int y=getY();
Actor collided;
collided = getOneIntersectingObject(Log.class);
boolean direction = getWorld().getObjects(Log.class).getDirection();
if (collided != null)
{
if (direction == true) {
setLocation(x+3,y);
}
else {
setLocation(x-3,y);
}
}
}
}
