Size boxSize(100, 124);
ccPointSize(30);
ccDrawColor4B(255, 255, 255, 130);
ccDrawPoint(this->getPosition());
auto box = LayerColor::create(Color4B(255, 255, 0, 255));
box->setAnchorPoint(Vec2(0.5, 0.5));
box->setContentSize(boxSize);
box->ignoreAnchorPointForPosition(false);
box->setPosition(mPlayer->getBoundingBox().origin.x, mPlayer->getBoundingBox().origin.y);
this->addChild(box, 4);
ccPointSize(30);
ccDrawColor4B(255, 255, 255, 130);
ccDrawPoint(this->getPosition());
auto box = LayerColor::create(Color4B(255, 255, 0, 255));
box->setAnchorPoint(Vec2(0.5, 0.5));
box->setContentSize(boxSize);
box->ignoreAnchorPointForPosition(false);
box->setPosition(mPlayer->getBoundingBox().origin.x, mPlayer->getBoundingBox().origin.y);
this->addChild(box, 4);
}
直接添加代码即可