我正在开发像水果忍者这样的游戏,目前我只使用一个水果名称facebook 现在,游泳池已经准备好,但是当我定义
时,正在开发水果池 1. private TextureRegion facebook;
2. facebook = BitmapTextureAtlasTextureRegionFactory.createFromAsset(
3. this.mBitmapTextureAtlas, this, "facebook.png", 0, 0);
4. target = new TargetsPool(facebook);
在我的simplebasegameactivity中给出了第4行的错误target = new TargetsPool(facebook);并说当我去代码时,将facebook的类型更改为TextureRegion
org.anddev.andengine.opengl.texture.region.TextureRegion
代替第1行中的TextureRegion生成
public class TargetsPool extends GenericPool<Sprite> {
private TextureRegion mTextureRegion;
public TargetsPool(TextureRegion facebook) {
if (facebook == null) {
// Need to be able to create a Sprite so the Pool needs to have a
// TextureRegion
throw new IllegalArgumentException(
"The texture region must not be NULL");
}
mTextureRegion = facebook;
}
@Override
protected Sprite onAllocatePoolItem() {
Sprite sprite =new Sprite(0, 0, mTextureRegion.deepCopy());
return sprite;
}
protected void onHandleRecycleItem(final Sprite target) {
target.clearEntityModifiers();
target.clearUpdateHandlers();
target.setVisible(false);
target.detachSelf();
target.reset();
}
}
这是一个演员问题,当我使用andengine一段时间org.anddev.andengie有时工作org.andengine这通常会得到。