So my game is basically this penguin (actor) going to another side by hopping on moving clouds (those that move to the right are Cloud and those that move to the left are LeftCloud). I have been trying to make the penguin stay on the cloud once it's on it without me having to control it using type keys, but nothing seems to work. Any ideas?
public void act()
{
checkKeys();
checkFall();
checkCloud();
}
public void checkCloud() {
for(int i = 0; i < 30; i++) {
Actor cloudyR = getOneObjectAtOffset(0,i-5, Cloud.class);
if(cloudyR != null) {
setLocation(cloudyR.getX(), cloudyR.getY());
break;
}
Actor cloudyL = getOneObjectAtOffset(0,i-5, CloudLeft.class);
if(cloudyL != null) {
setLocation(cloudyL.getX(), cloudyL.getY());
break;
}
}
}
Actor cloudyL = getOneObjectAtOffset(0,i-5, CloudLeft.class);
if(cloudyL != null) {
setLocation(cloudyL.getX(), cloudyL.getY());
break;
}
}
