本文整理汇总了C++中BallSprite::setTag方法的典型用法代码示例。如果您正苦于以下问题:C++ BallSprite::setTag方法的具体用法?C++ BallSprite::setTag怎么用?C++ BallSprite::setTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BallSprite
的用法示例。
在下文中一共展示了BallSprite::setTag方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mt
BallSprite *GameScene_Box2D::createSprite(Vec2 &pos, Vec2 &velocity){
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> intval(0,3);
int val = (int)intval(mt);
__String *filename;
BallSprite::ballType type;
switch (val) {
case 0:
filename = String::create("ball.png");
type = BallSprite::ballType::kRed;
break;
case 1:
filename = String::create("pur_ball.png");
type = BallSprite::ballType::kPurple;
break;
case 2:
filename = String::create("blue_ball.png");
type = BallSprite::ballType::kBrue;
break;
case 3:
filename = String::create("yellow_ball.png");
type = BallSprite::ballType::kYellow;
break;
default:
filename = String::create("ball.png");
type = BallSprite::ballType::kBrue;
break;
}
//BallSprite *ball = BallSprite::createBallSprite(this, _world, filename->getCString());
BallSprite *ball = BallSprite::createParticleSprite(this, _world, _particleSystem, _particleGroup, filename->getCString());
//ball->setPosition(pos);
ball->setParticlePpos(_particleSystem, _particleGroup, pos.x, pos.y, velocity.x, velocity.y);
ball->setTag(spriteType::kBall);
ball->setBallType(type);
_bollArray.push_back(ball);
return ball;
}
示例2: mt
BallSprite *GameScene_Chipmunk::createSprite(Vec2 &pos){
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_real_distribution<double> intval(0,3);
int val = (int)intval(mt);
__String *filename;
BallSprite::ballType type;
switch (val) {
case 0:
filename = String::create("ball.png");
type = BallSprite::ballType::kRed;
break;
case 1:
filename = String::create("pur_ball.png");
type = BallSprite::ballType::kPurple;
break;
case 2:
filename = String::create("blue_ball.png");
type = BallSprite::ballType::kBrue;
break;
case 3:
filename = String::create("yellow_ball.png");
type = BallSprite::ballType::kYellow;
break;
default:
filename = String::create("ball.png");
type = BallSprite::ballType::kBrue;
break;
}
BallSprite *ball = BallSprite::createBallSprite(this, filename->getCString());
ball->setCenter(pos);
ball->setTag(spriteType::kBall);
ball->setBallType(type);
_bollArray.push_back(ball);
return ball;
}