Libgdx删除Sprite时出错

时间:2015-06-01 11:03:51

标签: java exception libgdx collision rectangles

我试图在敌人精灵碰撞到矩形时移除它,我也使用了游泳池。

public class MyFragPageAdapter extends FragmentPagerAdapter implements IconTabProvider {

    private final int[] ICONS = { R.drawable.ic_action_cc_bcc, R.drawable.ic_action_call, 
            R.drawable.ic_action_chat};
    private final String[] tabTitles = {"Contacts", "Calls", "Messages" };

    public FragmentPageAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int arg0) {
        switch (arg0) {
        case 0:
            return new ContactList();
        case 1:
            return new DialPad();
        case 2:
            return new BlockedList();
        default:
            break;
        }

        return null;
    }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public int getPageIconResId(int position) {
        // TODO Auto-generated method stub
        return ICONS[position];
    }

    /* (non-Javadoc)
     * @see android.support.v4.view.PagerAdapter#getPageTitle(int)
     */
    @Override
    public CharSequence getPageTitle(int position) {
        // TODO Auto-generated method stub
        return tabTitles[position];
    }

然后删除敌方法:

db.articles.aggregate(
    [ { $match : { author : "dave" } } ]
);

我收到此错误:

while(enemyIterator.hasNext()){
            Sprite sprite=enemyIterator.next();  //this is the line 65
            if(enemyRect.overlaps(treeObj.treeRect))
                removeEnemy(sprite);
        }

我按照他链接的问题的指示,我仍然得到错误,现在我只是试图删除矩形。

public void removeEnemy(Sprite sprite){
        enemies.remove(sprite);
        Pools.free(sprite);
    }

0 个答案:

没有答案