我该如何解决这个问题?

发布于 2024-11-01 21:57:33 字数 284 浏览 1 评论 0原文

这是我的代码: http://pastie.org/1795351

我希望此代码能够删除 af 或 bf(如果其接触地面) 。但我不能这样做,因为“无法定义 bf 的属性”和 af。

我需要将它放在其他函数之外,因为否则我会有很多代码。

if(bf || af.hitTestObject(Basket)){
removeChild(bf || af);
}

This is my code:
http://pastie.org/1795351

I want this code to be able to remove af or bf if its touching ground. But I can't do that because "cant define property of bf" and af.

And I need to have it outside the other functions because I will have alot of code otherwise.

if(bf || af.hitTestObject(Basket)){
removeChild(bf || af);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

多彩岁月 2024-11-08 21:57:33
function checkGroundHit(object Sprite):void
{
    if (ground.hitTest(object))
    {
         object.parent.removeChild(object);
    }
}

checkBasketHit(af);
checkBasketHit(bf);

我在你的代码中没有看到可以测试的依据,也许你错过了?

function checkGroundHit(object Sprite):void
{
    if (ground.hitTest(object))
    {
         object.parent.removeChild(object);
    }
}

checkBasketHit(af);
checkBasketHit(bf);

I see no ground in your code to test against, maybe you missed it?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文