I am working on a platformer at the moment and I can't seem to get a couple pieces of code working.
The following code:
Is not producing desirable results. My actor is phasing through the other actor rather than standing on top.
The 62 pixel offset is to make it stand on top instead of the middle of the floor.
The following code:
Makes the floor move to the left under the player and then should keep generating ones under it. It was working before, although not perfectly, a few number adjustments to be made. But now there are massive gaps between floor actors.
The floor actor is this:
And the player actor is this: 
Actor floor = getOneObjectAtOffset(0, 0, floor.class);
if (floor != null) {
groundLevel = (getY()-62);
}
else {groundLevel=545;} public void act()
{
floorY = getY();
if (Greenfoot.isKeyDown("d")){
move(-2);
}
if (getX()<637 && getX()>635) {
getWorld().addObject(new floor(),2580,635);
}
if (isOffScreen()) {
getWorld().removeObject(this);
}
}
public boolean isOffScreen()
{
if (getX() < 0 - getImage().getWidth()/2){
return true;
}
return false;
}
And the player actor is this: 
