Exemplo n.º 1
0
void Hero::initPhysics() {
    PhysicsBody* pbody = nullptr;
    pbody = PhysicsBody::createBox(getSize());
    pbody->setDynamic(true);
    pbody->setRotationEnable(false);
    pbody->setMoment(0);
    pbody->setMass(0.8);
    pbody->setContactTestBitmask(1);
    pbody->setGravityEnable(false);
    getSprite()->setPhysicsBody(pbody);
    
    mEnableGravity = true;
    mEnableForceField = true;
}