[英]Detect the screen boundary and prevent the sprite from going beyond it in AndEngine
目前,我正在這樣做
@Override
public EngineOptions onCreateEngineOptions() {
mCamera = new BoundCamera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
mCamera.setBoundsEnabled(true);
return engineOptions;
}
但是,在橫向模式下,它從右側超出了屏幕。 如何限制精靈離開屏幕?
一種非常糟糕的方法是添加一個看不見的物理構造,使其無法通過。 或在精靈中並覆蓋onManaged更新,這將使您檢查沖突
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.