当前位置: 首页>>代码示例>>C++>>正文


C++ PhysicsBody::setRotationEnable方法代码示例

本文整理汇总了C++中PhysicsBody::setRotationEnable方法的典型用法代码示例。如果您正苦于以下问题:C++ PhysicsBody::setRotationEnable方法的具体用法?C++ PhysicsBody::setRotationEnable怎么用?C++ PhysicsBody::setRotationEnable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PhysicsBody的用法示例。


在下文中一共展示了PhysicsBody::setRotationEnable方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

bool HeroSprite::init() {
	bool bRet = false;

	do {
		CC_BREAK_IF(!Sprite::initWithSpriteFrameName("heroStand_0001.png"));

		Size heroSize = this->getContentSize();
		PhysicsBody *body = PhysicsBody::createBox(heroSize-Size(0,16), PhysicsMaterial(0, 0, 0));
		body->setLinearDamping(0.0f);
		body->setDynamic(true);
		body->setGravityEnable(true);
		body->setTag(TAG_HERO_PHYS_BODY);
		body->setCategoryBitmask(1<<2);
		body->setContactTestBitmask(1<<0 | 1<<1);
		body->setMass(50);
		body->setRotationEnable(false);

		this->setPhysicsBody(body);

		mState = STATE_IDLE;
        mRunAnimate = NULL;
        mSmokeRunAnimate = NULL;

		bRet = true;
	} while(0);

	return bRet;
}
开发者ID:liangxiaoju,项目名称:codes,代码行数:28,代码来源:HeroSprite.cpp

示例2: initBody

void SpeedUpProtect::initBody()
{
	auto s = getContentSize();
	Vec2 vec[7] = 
	{
		Vec2(0,0),
		Vec2(s.width * 0.1, s.height * 0.4),
		Vec2(s.width * 0.26, s.height * 0.72),
		Vec2(s.width * 0.5, s.height),
		Vec2(s.width * 0.74, s.height * 0.72),
		Vec2(s.width * 0.9, s.height * 0.4),
		Vec2(s.width,0),
	};

	PhysicsBody* body = PhysicsBody::createPolygon(vec, 7, PHYSICSBODY_MATERIAL_DEFAULT, Vec2(-s.width*0.5,-s.height*0.5));
	body->setGravityEnable(false);
	body->setRotationEnable(false);
	body->setDynamic(false);
	body->setMass(10000000);
	body->setCategoryBitmask(SELF_SCOPE_CATEGORYBITMASK);
	body->setCollisionBitmask(SELF_SCOPE_COLLISIONBITMASK);
	body->setContactTestBitmask(SELF_SCOPE_CONTACTTESTBITMASK);
	setPhysicsBody(body);
	setInvincible(true);
	m_ContactPro.hurts = -Ene_Plane_Hp_max - 10;
}
开发者ID:Chonger8888,项目名称:project,代码行数:26,代码来源:SpecialBody.cpp

示例3: init

bool Monster::init()
{
	mutex = PTHREAD_MUTEX_INITIALIZER;
	status = DONE;
	auto snakeTexture = TextureCache::sharedTextureCache()->addImage(
			basic.getCString());
	float dWidth = snakeTexture->getContentSize().width / cntWidth;
	float dHeight = snakeTexture->getContentSize().height / cntHeight;

	this->setAnchorPoint(Vec2(0.5,32/dHeight));
	PhysicsBody *body = PhysicsBody::createBox(Size(60,60));
	body->setPositionOffset(Vec2(0,64/4-dHeight/4));
	body->setRotationEnable(false);
	body->setGravityEnable(false);
	body->setContactTestBitmask(0xffffffff);
	body->setCollisionBitmask(0xffffffff);
	this->setPhysicsBody(body);
	this->setTag(MONSTER);
	auto listener = EventListenerCustom::create("main_action",
			CC_CALLBACK_1(Monster::receive,this));
	_eventDispatcher->addEventListenerWithFixedPriority(listener, 1);
	return true;

	return false;
}
开发者ID:luchao0213,项目名称:workspace,代码行数:25,代码来源:Monster.cpp

示例4: init

bool guaiwu_js::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !Layer::init() )
    {
        return false;
    }
    auto root_layer = CSLoader::createNode("LayerUI/Other/guaiwu.csb");
    addChild(root_layer);
    auto rooaby = root_layer->getChildByName<Node*>("FileNode_1")->getChildByName<Sprite*>("anim_guaiwu_zo0001_2");
    PhysicsBody* phybody = PhysicsBody::createBox(Size(rooaby->getContentSize().width-8, rooaby->getContentSize().height-20));
    phybody->setTag(400001);
    phybody->setMass(3000);
    phybody->setRotationEnable(false);
    phybody->setCategoryBitmask(0x01);
    phybody->setCollisionBitmask(0x02);
    phybody->setContactTestBitmask(0x01);
    phybody->setDynamic(true);
    rooaby->setPhysicsBody(phybody);
    guaiwu = CSLoader::createTimeline("Node/animation/guaiwujs.csb");
    guaiwu->gotoFrameAndPlay(0,35, true);
    root_layer->runAction(guaiwu);
    scheduleUpdate();
    //添加碰撞事件
    auto collisionlistener = EventListenerPhysicsContact::create();
    collisionlistener->onContactBegin =CC_CALLBACK_1(guaiwu_js::onCollisionBegin, this);
    collisionlistener->onContactSeparate = CC_CALLBACK_1(guaiwu_js::onContactSeparate,this);
    Director::getInstance()->getEventDispatcher()->addEventListenerWithSceneGraphPriority(collisionlistener, this);
    return true;
}
开发者ID:jian22446688,项目名称:DesertTour,代码行数:31,代码来源:guaiwu_js.cpp

示例5: addPhysics

void Person::addPhysics()
{
	auto size = (this->getBoundingBox()).size;
	log("%lf %lf", size.width, size.height);
	auto material = PhysicsMaterial(100.0f, 0.01f, 1.0f);
	if(_type == TYPE::HERO) size.width /= 2;
	PhysicsBody *body = PhysicsBody::createBox(Size(size.width,size.height),material);
//	body->addShape(PhysicsShapeBox::create(Size(size.width,size.height),material));
	body->setCategoryBitmask(_type);
	if(_type == TYPE::MONSTER) 
	{
		body->setCollisionBitmask(TYPE::MONSTER  | TYPE::BRICK | TYPE::GROUND | 
			TYPE::TANGH | TYPE::BULLET | TYPE::BOSS | TYPE::PLANK);
		body->setContactTestBitmask(TYPE::MONSTER | TYPE::HERO | TYPE::BRICK | 
			TYPE::TANGH | TYPE::BULLET | TYPE::BOSS);
	}
	else if(_type == TYPE::HERO)
	{
		body->setCollisionBitmask( TYPE::HERO | TYPE::GROUND | TYPE::TANGH | TYPE::PLANK);
		body->setContactTestBitmask(TYPE::MONSTER | TYPE::HERO | TYPE::GROUND | 
			TYPE::TANGH | TYPE::BULLET | TYPE::TRAP | TYPE::BOSS |
			TYPE::BULLETENEMY | TYPE::PLANK | TYPE::BUFF);
	}
	else if(_type == TYPE::BOSS)
	{
		body->setCollisionBitmask( TYPE::HERO | TYPE::GROUND | TYPE::BOSS | PLANK);
		body->setContactTestBitmask( TYPE::HERO | TYPE::GROUND | TYPE::BOSS);
	}
	body->setDynamic(true);
	body->setLinearDamping(0.0f);
	body->setRotationEnable(false);
	body->setGravityEnable(true);
	this->setPhysicsBody(body);
}
开发者ID:joyfish,项目名称:gameClient,代码行数:34,代码来源:Person.cpp

示例6: setPhysical

void BoySprite::setPhysical() {
	// add the physical body
	PhysicsBody *body = PhysicsBody::create();
	body->addShape(NORMAL_SHAPE);
	body->setDynamic(true);
	body->setLinearDamping(0.0f);
	body->setRotationEnable(false);
	this->setPhysicsBody(body);
}
开发者ID:OiteBoys,项目名称:StreetBoy,代码行数:9,代码来源:BoySprite.cpp

示例7: initPhysics

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;
}
开发者ID:zxy2845986,项目名称:jumpproj,代码行数:14,代码来源:Blocks.cpp

示例8: init

bool Buff::init(int type)
{
    char txt[100];
    _type = type;
    sprintf(txt, "buff%d.png", type);
    if (!Sprite::initWithFile(txt)) {
        return false;
    }
    this->setTag(TYPE::BUFF);
    auto size = (this->getBoundingBox()).size;
    auto material = PhysicsMaterial(100.0f, 0.01f, 1.0f);
    PhysicsBody *body = PhysicsBody::createBox(Size(size.width,size.height),material);
    //	body->addShape(PhysicsShapeBox::create(Size(size.width,size.height),material));
    body->setCategoryBitmask(TYPE::BUFF);
    body->setCollisionBitmask(0);
    body->setContactTestBitmask(TYPE::BUFF | TYPE::HERO);
    body->setDynamic(false);
    body->setRotationEnable(false);
    this->setPhysicsBody(body);
    return true;
}
开发者ID:joyfish,项目名称:gameClient,代码行数:21,代码来源:Buff.cpp

示例9: addChild


//.........这里部分代码省略.........
    addChild(eit);
    
    Btn_QuestionSelect* qbs2 = Btn_QuestionSelect::create();
    qbs2->setObj(questionl4_1);
    qbs2->setIBtnMainUI(mainui, btngr);
    addChild(qbs2,30);
    //弹簧按按钮
    Btn_Standard* bs2 = Btn_Standard::create();
    bs2->setObj(btnl5_1);
    addChild(bs2,30);
    Btn_QuestionSelect* qbs3 = Btn_QuestionSelect::create();
    qbs3->setObj(questionl4_2);
    qbs3->setIBtnMainUI(mainui, bs2);
    addChild(qbs3,30);
    //怪物,门
    Btn_Standard* bs3 = Btn_Standard::create();
    bs3->setObj(btnl5_3);
    addChild(bs3,30);
    Btn_QuestionSelect* qbs4 = Btn_QuestionSelect::create();
    qbs4->setObj(questionl4_3);
    qbs4->setIBtnMainUI(mainui, bs3);
    addChild(qbs4,30);
    
    Layer* dlyer = Layer::create();
    dlyer->addChild(groundl5_5);
    addChild(dlyer);
    //怪物移动
    guaiwu_js* gu = guaiwu_js::create();
    gu->setGuanwu(monsterl5_1);
    gu->setMovePosition(monsterl5_2, monsterl5_3, 20.0f);
    addChild(gu);
    PhysicsBody* gua = PhysicsBody::createBox(monsterl5_0->getContentSize());
    gua->setTag(400030);
    gua->setRotationEnable(false);
    gua->setCategoryBitmask(0x01);
    gua->setCollisionBitmask(0x02);
    gua->setContactTestBitmask(0x01);
    gua->setDynamic(true);
    monsterl5_0->setPhysicsBody(gua);
    //添加力度
    bs2->getBtn()->addTouchEventListener([=](Ref* reft, Widget::TouchEventType type)
                                         {
                                             if (type==Widget::TouchEventType::ENDED) {
                                                 //bs2->PlayEffect();
                                                 //spr->addForce(Vec2(1000.0f, 1500.0f));
                                                 if (ismove) {
                                                     auto moveto = MoveTo::create(0.8f, Vec2(384.2f, move_17->getPosition().y));
                                                     move_17->runAction(moveto);
                                                     ismove = false;
                                                 }else{
                                                     auto moveto = MoveTo::create(0.8f, Vec2(159.2f, move_17->getPosition().y));
                                                     move_17->runAction(moveto);
                                                     ismove = true;
                                                 }
                                             }
                                         });
    //关门
    bs3->getBtn()->addTouchEventListener([=](Ref* reft, Widget::TouchEventType type)
                                         {
                                             if (type==Widget::TouchEventType::ENDED) {
                                                 bs2->PlayEffect();
                                                 auto scal = ScaleTo::create(1.0f, -1, 1);
                                                 gate->runAction(scal);
                                                 gua->setEnabled(false);
                                             }
                                         });
开发者ID:jian22446688,项目名称:DesertTour,代码行数:67,代码来源:Level_5.cpp

示例10: addChild


//.........这里部分代码省略.........
    addChild(mainui,3000);
    
    //添加第一个怪物
    //FileNode_5
    
    Node* jsa1 = root_level_2->getChildByName<Node*>("FileNode_5");
    
    Sprite* psa1 = root_level_2->getChildByName<Sprite*>("btn_010001_59_0_0");
    Sprite* psa2 = root_level_2->getChildByName<Sprite*>("btn_010001_59_0_0_0");
    Sprite* psa3 = root_level_2->getChildByName<Sprite*>("btn_010001_59_2");
    
    psa3->setVisible(false);
    
    //第一个怪物
    guaiwu_js* gw = guaiwu_js::create();
    gw->setGuanwu(jsa1);
    gw->setMovePosition(psa2, psa1, 18.0f);
    addChild(gw);
    
    
    
    //获取肉的精灵
    Sprite* rm = root_level_2->getChildByName<Sprite*>("s22_43");
    Sprite* r = root_level_2->getChildByName<Sprite*>("s23_50");
    r->setVisible(false);
    //设置肉的碰撞刚体
    PhysicsBody* phyr = PhysicsBody::createBox(Size(r->getContentSize().width/3,r->getContentSize().height-3));
    phyr->setEnabled(false);
    //设置触发 掩码
    phyr->setContactTestBitmask(0x01);
    phyr->setCollisionBitmask(0x02);
    phyr->setTag(400006);
    
    phyr->setRotationEnable(true);
    r->setPhysicsBody(phyr);
    
    //phyr->setCategoryBitmask(0x01);
    
    
    //火的按钮
    Sprite* h1 = root_level_2->getChildByName<Sprite*>("btn_010001_59_1");
    //实物的按钮
    Sprite* h2 = root_level_2->getChildByName<Sprite*>("btn_010001_59");
    //火的 问题 按钮
    Sprite* qh1 = root_level_2->getChildByName<Sprite*>("anim_question0001_60_0");
    //实物 问题 的按钮
    Sprite* qh2 = root_level_2->getChildByName<Sprite*>("anim_question0001_60");
    
    //按钮1
    Btn_Standard* hba1 =Btn_Standard::create();
    hba1->setObj(h1);
    addChild(hba1);
    hba1->getBtn()->addTouchEventListener([=](Ref* reft,Widget::TouchEventType type)
                                          {
                                              if (type ==Widget::TouchEventType::ENDED)
                                              {
                                                  hba1->PlayEffect();
                                                  //控制火的按钮
                                                  fireh1->gotoFrameAndPause(36);
                                                  fire1->getPhysicsBody()->setEnabled(false);
                                              }
                                          });
    
    //按钮2
    Btn_Standard* hba2 =Btn_Standard::create();
    hba2->setObj(h2);
开发者ID:jian22446688,项目名称:DesertTour,代码行数:67,代码来源:Level_2.cpp

示例11: init

bool HelloWorld::init(PhysicsWorld* world,int _level)
{
    if ( !Layer::init() )
    {
        return false;
    } 
	level = _level;
	//NotificationCenter::getInstance()->addObserver(this, callfuncO_selector(HelloWorld::setLevel), "selectedLevel", NULL);
	dispatcher = Director::getInstance()->getEventDispatcher();

	preLoadMusic();
	playBgMusic();

	m_world = world;
	//m_world->setAutoStep(false);
	m_world->setGravity(Vect(0,-grivity));
	this->setAnchorPoint(Point(0,0));
    winSize = Director::getInstance()->getWinSize();
	visibleSize = Director::getInstance()->getVisibleSize();
	origin = Director::getInstance()->getVisibleOrigin();

	auto map1path = String::createWithFormat("%s%d%s","images/level",level,"/bg.png");
	map1 = Sprite::create(map1path->getCString());
	map1->setPosition(map1->getContentSize().width/2+origin.x, map1->getContentSize().height/2+origin.y);
	this->addChild(map1,1,MAP1_TAG);
	auto map2path = String::createWithFormat("%s%d%s", "images/level", level, "/bg.png");
	map2 = Sprite::create(map2path->getCString());
	map2->setPosition(map1->getContentSize().width+map2->getContentSize().width/2+origin.x, map2->getContentSize().height/2+origin.y);
	this->addChild(map2,1,MAP2_TAG);

	Sprite* edge1 = Sprite::create();
	edge1->setContentSize(visibleSize);
	PhysicsBody* edgeBody1 = PhysicsBody::createEdgeBox(visibleSize);
	edgeBody1->setDynamic(false);
	edgeBody1->setGravityEnable(false);
	edgeBody1->setMass(100000.0f);
	edgeBody1->getShape(0)->setRestitution(0.0f);
	edgeBody1->setContactTestBitmask(0xFF);
	edgeBody1->setCategoryBitmask(0x04);
	edgeBody1->setCollisionBitmask(0xFF);
	edgeBody1->getShape(0)->setTag(EDGE_TAG);
	edge1->setPhysicsBody(edgeBody1);
	edge1->setPosition(visibleSize.width/2,visibleSize.height/2);
	addChild(edge1,1,EDGEONE_TAG);

	Sprite* edge = Sprite::create();
	edge->setContentSize(visibleSize);
	PhysicsBody* edgeBody = PhysicsBody::createEdgeBox(Size(visibleSize.width,visibleSize.height/6));
	edgeBody->setDynamic(false);
	edgeBody->setGravityEnable(false);
	edgeBody->setMass(100000.0f);
	edgeBody->getShape(0)->setRestitution(0.0f);
	edgeBody->setContactTestBitmask(0xFF);
	edgeBody->setCategoryBitmask(0x04);
	edgeBody->setCollisionBitmask(0xFF);
	edgeBody->getShape(0)->setTag(EDGE_TAG);
	edge->setPhysicsBody(edgeBody);
	edge->setPosition(visibleSize.width / 2, visibleSize.height / 12);
	addChild(edge, 1, EDGE_TAG);


	Sprite* floor = Sprite::create();
	PhysicsBody* floorBody = PhysicsBody::createEdgeSegment(Point(0, visibleSize.height / 10), Point(visibleSize.width, visibleSize.height / 10));
	floorBody->setDynamic(false);
	floorBody->setGravityEnable(false);
	floorBody->getShape(0)->setRestitution(0.0f);
	floorBody->setMass(100000.0f);
	floorBody->setCategoryBitmask(0x0003);
	floorBody->setContactTestBitmask(0x0003);
	floorBody->setCollisionBitmask(0x0001);
	floor->setPosition(0, visibleSize.height / 10);
	floor->setPhysicsBody(floorBody);
	//this->addChild(floor,2,FLOOR_TAG);

	setEnemyFrameNumber();
	setPlayerFrameNumber();
	initDamage();

	player1 = new player();
	auto playerPath = String::createWithFormat("%s%d%s", "images/level", level, "/player.png");
	player1->sprite = Sprite::create(playerPath->getCString());
	PhysicsBody* playerBody = PhysicsBody::createBox(player1->sprite->getContentSize());
	playerBody->setRotationEnable(false);
	playerBody->getShape(0)->setRestitution(0.0f);
	playerBody->getShape(0)->setFriction(0.8f);
	playerBody->setMass(player1->mass);
	playerBody->setCollisionBitmask(0x04);
	playerBody->setCategoryBitmask(0x01);
	playerBody->setContactTestBitmask(0xFF);
	playerBody->getShape(0)->setTag(PLAYER_TAG);
	player1->sprite->setPhysicsBody(playerBody);
	player1->sprite->setPosition(player1->sprite->getContentSize().width/2+5, floor->getPositionY()+player1->sprite->getContentSize().height*3);
	addChild(player1->sprite,2,PLAYER_TAG);

	preLoadAnimation();

	auto backItem = MenuItemImage::create("images/CloseNormal.png", "images/CloseSelected.png", CC_CALLBACK_0(HelloWorld::backToChoseLevel, this));
	//auto pauseItem = MenuItemImage::create("CloseNormal.png", "CloseSelected.png", CC_CALLBACK_0(HelloWorld::pauseScene, this));
	auto popupItem = MenuItemImage::create("images/CloseNormal.png", "images/CloseSelected.png", CC_CALLBACK_0(HelloWorld::toPopup, this));
	//pauseItem->setPosition(-backItem->getContentSize().width,0);
//.........这里部分代码省略.........
开发者ID:JimmyCheung94,项目名称:1,代码行数:101,代码来源:HelloWorldScene.cpp

示例12: setupPhysics

void SinglePlayerScene::setupPhysics()
{
    Size visibleSize = Director::getInstance()->getVisibleSize();

    float visibleHeight = visibleSize.height;
    PhysicsWorld* world = this->getScene()->getPhysicsWorld();
    world->setGravity(Vec2(0, (visibleHeight / 320.0f) * -98.0f));
    world->setSpeed(GAME_SPEED);

    world->setDebugDrawMask(DEBUGDRAW_OPTIONS);


    Vec2 takyanPos = _takyan->getPosition();
    PhysicsBody *takyanBody = PhysicsBody::createCircle(_takyan->getContentSize().width * BALL_RADIUS, PhysicsMaterial(0.01f, 1.0f, 1.0f)); //_takyan->getPhysicsBody();
    float takyanMass = takyanBody->getMass();
    float velocityLimit = takyanMass * 150.0f;
    takyanBody->setMass(takyanMass * 100.0f);
    takyanBody->setRotationEnable(false);
    takyanBody->setVelocityLimit(velocityLimit);
    _takyan->setPhysicsBody(takyanBody);

    PHYSICS_MASK(takyanBody, MASK_TAKYAN, MASK_BOUNDS | MASK_KICKER, MASK_BOUNDS | MASK_KICKER);

    Size takyanSize = _takyan->getContentSize();
    takyanSize.height *= 0.8f;

    PhysicsMaterial material(0.0025f, 0.0f, 1.0f);
    PhysicsBody *takyanTailBody = PhysicsBody::createCircle(takyanSize.width, material);
    takyanTailBody->setMass(takyanMass * 0.01);
    takyanTailBody->setRotationEnable(false);
    takyanTailBody->setLinearDamping(1.0f);
    takyanTailBody->setVelocityLimit(velocityLimit * 0.5f);
    _takyanTail->setPhysicsBody(takyanTailBody);

    PHYSICS_MASK(takyanTailBody, MASK_TAKYAN_TAIL, 0, MASK_FLOOR);

    Vec2 diff = _takyanTail->getPosition() - _takyan->getPosition();
    Vec2 anch1 = Vec2::ANCHOR_MIDDLE;
    Vec2 anch2 = Vec2::ANCHOR_MIDDLE;
    auto jointS = PhysicsJointLimit::construct(takyanBody, takyanTailBody, anch1, anch2, 0, diff.y);
    jointS->setCollisionEnable(false);
    world->addJoint(jointS);


    PhysicsBody *kickerBody = PhysicsBody::createCircle(_kicker->getContentSize().width * KICKER_RADIUS, PhysicsMaterial(1.0f, 1.0f, 1.0f)); //_kicker->getPhysicsBody();
    kickerBody->setDynamic(false);
    kickerBody->setEnable(false);
    _kicker->setPhysicsBody(kickerBody);

    PHYSICS_MASK(kickerBody, MASK_KICKER, MASK_TAKYAN, MASK_TAKYAN);

    int takyans = MASK_TAKYAN | MASK_TAKYAN_TAIL;

    auto floorBody = PhysicsBody::createBox(_floorBounds->getContentSize(), PhysicsMaterial(1.0f, 0.3f, 0.7f)); //_floorBounds->getPhysicsBody();
    floorBody->setDynamic(false);
    _floorBounds->setPhysicsBody(floorBody);
    PHYSICS_MASK(floorBody, MASK_BOUNDS, takyans, takyans);

    auto ceilingBody = PhysicsBody::createBox(_ceilingBounds->getContentSize(), PhysicsMaterial(1.0f, 0.3f, 0.7f));
    ceilingBody->setDynamic(false);
    _ceilingBounds->setPhysicsBody(ceilingBody);
    PHYSICS_MASK(ceilingBody, MASK_BOUNDS, MASK_TAKYAN, MASK_TAKYAN);

    Size wallSize = _leftWallBounds->getContentSize();
    wallSize.height *= 5.0f;

    auto leftWallBody = PhysicsBody::createBox(wallSize); //_leftWallBounds->getPhysicsBody();
    leftWallBody->setDynamic(false);
    _leftWallBounds->setPhysicsBody(leftWallBody);
    PHYSICS_MASK(leftWallBody, MASK_WALLS, takyans, MASK_TAKYAN);

    auto rightWallBody = PhysicsBody::createBox(wallSize); //_rightWallBounds->getPhysicsBody();
    rightWallBody->setDynamic(false);
    _rightWallBounds->setPhysicsBody(rightWallBody);
    PHYSICS_MASK(rightWallBody, MASK_WALLS, takyans, MASK_TAKYAN);
}
开发者ID:eiji11,项目名称:takyan,代码行数:76,代码来源:SinglePlayerScene.cpp


注:本文中的PhysicsBody::setRotationEnable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。