Created
August 23, 2012 09:43
-
-
Save panmari/3434786 to your computer and use it in GitHub Desktop.
isNearBorder() doesn't work as expected when using windowZoom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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