cocos creator版本:3.3.1
我要做一个类似坦克大战的游戏,就写了这么几句话:
import { _decorator, Component, Collider2D, Contact2DType } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('Bullet')
export class Bullet extends Component {
onLoad() {
this.getComponent(Collider2D).on(Contact2DType.BEGIN_CONTACT, this.onHit, this);
}
onHit(self: Collider2D, other: Collider2D) {
this.node.destroy();
}
}
结果:
这是我写的问题,还是Creator的问题?

