Skip to content

Instantly share code, notes, and snippets.

@panmari
Created August 23, 2012 09:43
Show Gist options
  • Save panmari/3434786 to your computer and use it in GitHub Desktop.
Save panmari/3434786 to your computer and use it in GitHub Desktop.
isNearBorder() doesn't work as expected when using windowZoom
package online.app2;
import ch.aplu.android.*;
import android.graphics.Color;
public class TestBorder extends GameGrid
{
public TestBorder()
{
super(true, windowZoom(200));
}
public void main()
{
addActor(new Ghost(), new Location(50,50));
setSimulationPeriod(20);
doRun();
}
}
class Ghost extends Actor
{
public Ghost() {
super("ghost");
}
public void act() {
//if (isMoveValid()) //the commented out way, it works
move();
// else
if (isNearBorder()) //FIXME: always returns false
turn(180);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment