2017년 6월 5일 월요일

cocos creator 물리엔진 컨텍테스트

cocos creator


물리엔진 컨텍테스트
cc.Class({
    extends: cc.Component,

    properties: {
       
        contacDmg: 0.1,
               
        hpBar: {
            default: null,
            type: cc.ProgressBar
        },      
  
    },


    onEnable : function () {
        // cc.director.getCollisionManager().enabled = true;
        // cc.director.getCollisionManager().enabledDebugDraw = true;
       
        cc.director.getPhysicsManager().enabled = true;
        cc.director.getPhysicsManager().enabledDebugDraw = true;

        console.log ('contact collition init....');

    },
   

    // onCollisionEnter: function (other,self) {
    //     // console.log ('contact..');

    //     this.hpBar.progress -= this.contacDmg;
       
       
    // },
   
    onBeginContact: function (otherCollider,selfCollider) {
       //onBeginContact: function (contact, selfCollider, otherCollider) {
        console.log('contact')  
        this.hpBar.progress -= this.contacDmg;
          
    },
   

    // called every frame, uncomment this function to activate update callback
    // update: function (dt) {

    // },
   
 
});