Closed GoogleCodeExporter closed 8 years ago
The problem is in DrawableObject.java, function isOnScreen().
This function uses currently a calculation that only works for positive values
for x, y, width and height.
Original comment by tobias.w...@gmail.com
on 23 Jul 2010 at 3:40
This fixes the problem:
public boolean isOnScreen() {
if(parentLayer == null) {
return false;
}
float maxSize = width;
if(height > width) maxSize = height;
if(parentLayer.ignoreWindow || parentScene.window == null) {
if (getX() - (maxSize / 2) < RokonActivity.gameWidth && getX() + maxSize + (maxSize / 2) > 0 && getY() - (maxSize / 2) < RokonActivity.gameHeight && getY() + maxSize + (maxSize / 2) > 0) {
return true;
}
} else {
boolean validY=false;
if(parentScene.window.height<0)
{
if(getY() - (maxSize / 2) < parentScene.window.getY() && getY() + maxSize + (maxSize / 2) > parentScene.window.height + parentScene.window.getY())
validY=true;
}
else
{
if(getY() - (maxSize / 2) < parentScene.window.height + parentScene.window.getY() && getY() + maxSize + (maxSize / 2) > parentScene.window.getY())
validY=true;
}
boolean validX=false;
if(parentScene.window.width<0)
{
if(getX() - (maxSize / 2) < parentScene.window.getX() && getX() + maxSize + (maxSize / 2) > parentScene.window.width + parentScene.window.getX())
validX=true;
}
else
{
if(getX() - (maxSize / 2) < parentScene.window.getX() + parentScene.window.width && getX() + maxSize + (maxSize / 2) > parentScene.window.getX())
validX=true;
}
if (validX && validY) {
return true;
}
}
return false;
}
Original comment by tobias.w...@gmail.com
on 23 Jul 2010 at 3:59
You're right, thanks
Original comment by rtaylor205@gmail.com
on 25 Jul 2010 at 9:04
Original issue reported on code.google.com by
tobias.w...@gmail.com
on 23 Jul 2010 at 3:13