【发布时间】:2014-04-11 00:26:58
【问题描述】:
晚上好/早上好。
我正在 As3 中创建一个游戏,其中敌人是添加而不是动态添加的。
if(hero attacks enemy)
{ then parent.removeChild(enemy) }
当英雄攻击敌人时,我认为敌人会将其从显示列表中删除。
但是当您重置关卡时,即返回开始菜单并返回关卡时,您会看到敌人不在关卡中,因为它们已被移除。
我的问题是,有没有办法可以重置该帧中的显示对象,在 As2 中我刷新了 Flash 电影。但这在编码方面并不好,因为它表明您没有发展或学习。
如果没有办法,您会建议动态添加将要删除的对象吗?
另一个问题是我的关卡在一个容器中。
//on the stage, there is a movieclip called container.
//In this container mc(movie clip) it contains the whole level, including platforms,
//enemies and props
如果我从那个容器中移除一个道具,为了重置游戏我会这样做
container.addChild(prop)
//the question is that how do I set it's x and y position?
谢谢你,我会感谢每一个反馈和建议。
【问题讨论】:
标签: actionscript-3 flashdevelop