摘要: 在游戏中,文本是必不可少的元素之一,通常创建了一个文本内容,还有可能会随时更改它,创建一个文本的方法如下(摘至Andengine源码中的TextExample.java): this.mFont = FontFactory.create(this.getFontManager(), this.getTextureManager(), 256, 256, Typeface.create(Typef... 阅读全文
posted @ 2013-03-06 15:34 路人 乙 阅读(452) 评论(0) 推荐(0) 编辑
摘要: 近期在使用Andengine框架写一个小游戏,在动态删除精灵时遇到了IndexOutOfBoundsException的问题,google了一下,在StackOverflow上找到了解决方案。首先添加一个精灵的方法:scene.attachChild(sprite);删除一个精灵类的方法:scene.detachChild(sprite);sprite.dispose();sprite= null;IndexOutOfBoundsException原因是画面更新的线程会获取当前场景的所有元素实体,此时移除了精灵,又在画面更新线程中读到这个元素,导致索引越界了。移除精灵类则需要放在UIThrea 阅读全文
posted @ 2013-03-06 15:12 路人 乙 阅读(369) 评论(0) 推荐(0) 编辑