MCPcopy Create free account
hub / github.com/Open-GD/OpenGD / spawnCircle

Method spawnCircle

Source/PlayLayer.cpp:131–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

129}
130
131void PlayLayer::spawnCircle()
132{
133 auto size = Director::getInstance()->getWinSize();
134
135 auto minArea = Vec2({40, 70});
136 auto maxArea = Vec2({size.width - 40, size.height - 70});
137
138 float x = ((float)rand() / (float)RAND_MAX) * (maxArea.x - minArea.x) + minArea.x;
139 float y = ((float)rand() / (float)RAND_MAX) * (maxArea.y - minArea.y) + minArea.y;
140
141 auto col1 = _player1->getMainColor();
142 auto cir = CircleWave::create(0.5f, {col1.r, col1.g, col1.b, 255}, 5.f, 50, true, false);
143 cir->setPosition({x, y});
144 m_pHudLayer->addChild(cir, -1);
145}
146
147void PlayLayer::showEndLayer()
148{

Callers

nothing calls this directly

Calls 4

createFunction · 0.85
getMainColorMethod · 0.80
setPositionMethod · 0.80
Vec2Class · 0.70

Tested by

no test coverage detected