{"size": 565, "ext": "js", "max_stars_repo_path": "assets/Script/bullet.js", "max_stars_repo_name": "BigBerlin/Anubis", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "assets/Script/bullet.js", "max_issues_repo_name": "BigBerlin/Anubis", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "assets/Script/bullet.js", "max_forks_repo_name": "BigBerlin/Anubis", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.2258064516, "max_line_length": 62, "alphanum_fraction": 0.6194690265}
import {Global} from './Global'

const {ccclass, property} = cc._decorator;

@ccclass
export default class bullet extends cc.Component {

    @property
    speed = 200;

    onLoad () {
        this.rigidBody = this.node.getComponent(cc.RigidBody);
    }

    onBeginContact(contact, selfCollider, otherCollider) {
        //子弹消失动画
        Global.putBullet(this.node);    //作为回调函数
    }

    init(position, dir) {
        this.node.position = position;

        const speedX = dir * this.speed;

        this.rigidBody.linearVelocity = cc.v2(speedX, 0);
    }

}


