Game Development Reference
In-Depth Information
meteor->runAction(sequence);
_fallingObjects.pushBack(meteor);
}
2. We grab the next available meteor from the pool, then we pick a random start and
end x value for its MoveTo action. The meteor starts at the top of the screen and
will move to the bottom towards the city, but the x value is randomly picked each
time.
3. We rotate the meteor inside a RepeatForever action, and we use Sequence
to move the sprite to its target position and then call back fallingOb-
jectDone when the meteor has reached its target. We finish by adding the new
meteor we retrieved from the pool to the _fallingObjects vector so we can
check collisions with it.
4. The method to retrieve the health ( resetHealth ) sprites is pretty much the
same, except that swingHealth action is used instead of rotate. You'll find that
method already implemented in GameLayer.cpp .
Search WWH ::




Custom Search