本文整理汇总了C++中Obstacle::init方法的典型用法代码示例。如果您正苦于以下问题:C++ Obstacle::init方法的具体用法?C++ Obstacle::init怎么用?C++ Obstacle::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obstacle
的用法示例。
在下文中一共展示了Obstacle::init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
// initialize each object that will be shown on screen
void init()
{
glutIgnoreKeyRepeat(1);
glEnable(GL_LINE_STIPPLE);
ball.init();
player.init();
ai.init();
o1.init();
o2.init();
}
示例2: createMap
void Map::createMap()
{
//TODO : Add a quadrant system
const int w = m_pSurface->w / World::ratio;
const int h = m_pSurface->h / World::ratio;
b2Vec2 oldPos(0.0f,0.f);
const float minDis = 3;
for(unsigned int i=0; i<16*5; i++)
{
bool foundPos = false;
while(foundPos == false)
{
b2Vec2 pos(rand()%w, rand()%h);
if(b2DistanceSquared(pos, oldPos) >= minDis)
{
foundPos = true;
oldPos = pos;
}
}
Obstacle * obs = new Obstacle(m_pWorld, oldPos);
obs->init();
m_Obstacles.push_back(obs);
}
}
示例3: create
Obstacle* Obstacle::create(Obstacle::Type type)
{
Obstacle *ret = new Obstacle();
if (ret && ret->init(type))
{
ret->autorelease();
}
else
{
CC_SAFE_DELETE(ret);
}
return ret;
};
示例4: initApp
void ColoredCubeApp::initApp()
{
D3DApp::initApp();
audio->playCue(MAIN_TRACK);
srand(time(0));
left = Vector3(1,0,0);
right = Vector3(-1,0,0);
forward = Vector3(0,0,-1);
back = Vector3(0,0,1);
up = Vector3(0,1,0);
down = Vector3(0,-1,0);
zero = Vector3(0,0,0);
whiteBox.init(md3dDevice, 1.0f, WHITE);
redBox.init(md3dDevice, 1.0f, RED);
blueBox.init(md3dDevice, 1.0f, BLUE);
greenBox.init(md3dDevice, 1.0f, GREEN);
crimBox.init(md3dDevice, 0.8f, CRIMSON);
dRedBox.init(md3dDevice, 0.8f, DARKRED);
dBlueBox.init(md3dDevice, 0.25f, DARKBLUE);
line.init(md3dDevice, 10.0f, GREEN);
////// New Stuff added by Steve //////
gLine.init(md3dDevice, 10.0f, GREEN);
rLine.init(md3dDevice, 10.0f, RED);
bLine.init(md3dDevice, 10.0f, BLUE);
xLine.init(&rLine, Vector3(0,0,0), 10);
xLine.setPosition(Vector3(0,0,0));
yLine.init(&gLine, Vector3(0,0,0), 10);
yLine.setPosition(Vector3(0,0,0));
yLine.setRotationZ(ToRadian(90));
zLine.init(&bLine, Vector3(0,0,0), 10);
zLine.setPosition(Vector3(0,0,0));
zLine.setRotationY(ToRadian(90));
numberOfObstacles = 50;
float obstacleScale = 2.5f;
float playerScale = 2.67f;
Vector3 oScale(obstacleScale, obstacleScale, obstacleScale);
Vector3 pScale(playerScale, playerScale, playerScale);
playerBox.init(md3dDevice, playerScale, WHITE);
player.init(&playerBox, sqrt(playerScale * 2.0f), Vector3(0, 2, 0), Vector3(0, 0, 0), 10, pScale, audio);
player.linkInput(input);
int posZ = 0;
int posX = 0;
int chance = 0;
int r = 0;
float floorSpeed = floor.getSpeed();
for (int i=0; i<numberOfObstacles; ++i)
{
Box* box = new Box();
box->init(md3dDevice, obstacleScale, GREEN);
obstacleBoxes.push_back(box);
Obstacle o;
o.init(box, sqrt(5.0f), Vector3(0,0,200), Vector3(0,0,-1), 0, Vector3(oScale));
o.setInActive();
obstacles.push_back(o);
}
///Set obstacle cluster variables
clusterSize = 1;
clusterSizeVariation = 3;
clusterSeparation = 100;
cubeSeparation = 30;
lineJiggle = 3;
cubeJiggle = 3;
clusterJiggle = 10;
floorMovement = 0.0f;
//Other floor variables
floorClusterCounter = 0;
floorClusterThreshold = 7;
floorSpeedIncrease = 5;
//New spectrum HUD by Andy
specHudBox[0].init(md3dDevice, .5f, 1.0f, 1.0f, RED, YELLOW);
specHudBox[1].init(md3dDevice, .5f, 1.0f, 1.0f, YELLOW, GREEN);
specHudBox[2].init(md3dDevice, .5f, 1.0f, 1.0f, GREEN, CYAN);
specHudBox[3].init(md3dDevice, .5f, 1.0f, 1.0f, CYAN, BLUE);
specHudBox[4].init(md3dDevice, .5f, 1.0f, 1.0f, BLUE, MAGENTA);
specHudBox[5].init(md3dDevice, .5f, 1.0f, 1.0f, MAGENTA, RED);
cursorBox.init(md3dDevice, .15f, 1.0f, .75f, BLACK, BLACK);
Vector3 specPos = Vector3(11.0f, 25.0f, -5.0f);
spectrum[0].init(&specHudBox[0], 1.0f,specPos + Vector3(0.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[1].init(&specHudBox[1], 1.0f,specPos + Vector3(2.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[2].init(&specHudBox[2], 1.0f,specPos + Vector3(4.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[3].init(&specHudBox[3], 1.0f,specPos + Vector3(6.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[4].init(&specHudBox[4], 1.0f,specPos + Vector3(8.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
spectrum[5].init(&specHudBox[5], 1.0f,specPos + Vector3(10.0f,0.0f,0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
cursor.init(&cursorBox,1.0f,specPos + Vector3(-.80f, -1.0f, 0.0f), Vector3(0.0f,0.0f,0.0f), 0, Vector3(0.0f,0.0f,0.0f));
gameObject1.init(&whiteBox, sqrt(2.0f), Vector3(-10,0,0), Vector3(0,0,0), 0,Vector3(2,2,2));
gameObject2.init(&redBox, sqrt(2.0f), Vector3(4,0,0), Vector3(0,0,0), 0,Vector3(2,2,2));
gameObject3.init(&redBox, sqrt(2.0f), Vector3(-4,0,0), Vector3(0,0,0), 0,Vector3(2,2,2));
//.........这里部分代码省略.........