本文整理汇总了C++中Platform::addPlatformBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ Platform::addPlatformBlock方法的具体用法?C++ Platform::addPlatformBlock怎么用?C++ Platform::addPlatformBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Platform
的用法示例。
在下文中一共展示了Platform::addPlatformBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: generatePlatform
Platform* MapGenerator::generatePlatform(Vector2d* startVector)
{
// 1. get possible set
// 2. get allowed set
// 3. modify chance (using buffer & deltaY)
// 4. select GeneratedBlock
// 5. add platformblock to platform
// 6. add used GeneratedBlock to buffer
Platform* platform = new Platform();
set<GeneratedBlock> possibleSet = allZeroes;
set<GeneratedBlock> allowedSet = getAllowedSet(possibleSet, startVector);
modifyChances(allowedSet, startVector);
GeneratedBlock* selectedBlock = selectBlock(allowedSet);
PlatformBlock* block = new PlatformBlock(selectedBlock->type, startVector);
platform->addPlatformBlock(block);
Vector2d* newStartVector = block->getEndVector();
addToBuffer(*selectedBlock);
int length = (PLATFORM_LENGTH_MIN - 1) + (rand() % (2 + PLATFORM_LENGTH_MAX - PLATFORM_LENGTH_MIN));
for (int i = 0; i < length; i++) {
possibleSet = getPossibleSet(selectedBlock);
allowedSet = getAllowedSet(possibleSet, newStartVector);
modifyChances(allowedSet, newStartVector);
selectedBlock = selectBlock(allowedSet);
*newStartVector+=Vector2d(0.f, selectedBlock->dy);
block = new PlatformBlock(selectedBlock->type, newStartVector);
platform->addPlatformBlock(block);
newStartVector = block->getEndVector();
addToBuffer(*selectedBlock);
}
return platform;
}
示例2: generateFlatPlatform
Platform* MapGenerator::generateFlatPlatform(Vector2d* startVector, int length)
{
Platform* platform = new Platform();
for (int i = 0; i < length; i++) {
PlatformBlock* block = new PlatformBlock(HORIZONTAL, startVector);
platform->addPlatformBlock(block);
startVector = block->getEndVector();
}
return platform;
}