【问题标题】:how can i do a hitest with 2 classes我怎样才能用 2 个类做一个 hittest
【发布时间】:2011-09-03 16:43:13
【问题描述】:

我怎样才能用 2 类进行命中 1 类称为敌人,第二类称为玩家 他们都是movieclip类,movieclip有实例 敌人类movieclip =敌人 和播放器类movieclip = Player

你能给我代码吗?我被困在这两天了,请帮忙

谢谢 快男619 actionscript.org 论坛的

【问题讨论】:

    标签: flash actionscript-3 adobe flash-cs5


    【解决方案1】:

    这很简单。下面是一个教程链接 + 一段专门执行此操作的代码教程的摘录:

    if (circle.hitTestObject(square)) {
         hittext.text = "Ouch!";
    } else {
         hittext.text = "";
    }
    

    http://www.foundation-flash.com/tutorials/as3hittesting/

    【讨论】:

      猜你喜欢
      • 2019-09-01
      • 1970-01-01
      • 2021-04-13
      • 2021-10-25
      • 1970-01-01
      • 1970-01-01
      • 2014-01-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多