Flash 动作脚本 +检测边缘碰撞
我有两个圆形物体。我试图在圆圈接触时立即进行检测。当一个圆到达另一个圆的中心时,跟踪检测到碰撞,但我希望圆一接触就检测到碰撞。
我的两个符号是 coin_mc 和 mugbounds_mc。
function checkHitArea(evt:Event)
{
if (coin_mc.hitTestPoint(mugbounds_mc.x,mugbounds_mc.y, true)) {
coin_mc.x=-1;
coin_mc.y=-1;
trace("Hit Mug"); // Is triggered when coin_mc reaches center of mugbounds_mc
}
else
{
trace("Didn't Hit Mug");
}
}
I have two circular objects. I'm trying to detect as soon as the circles touch. The trace detects a collision when one circle reaches the center of the other but I want the collision to be detected as soon as the circles touch.
My two symbols are coin_mc and mugbounds_mc.
function checkHitArea(evt:Event)
{
if (coin_mc.hitTestPoint(mugbounds_mc.x,mugbounds_mc.y, true)) {
coin_mc.x=-1;
coin_mc.y=-1;
trace("Hit Mug"); // Is triggered when coin_mc reaches center of mugbounds_mc
}
else
{
trace("Didn't Hit Mug");
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个:
我将您的影片剪辑重命名为 a 和 b。
Try this:
I renamed your movie clips to a and b.