Game Development Reference
In-Depth Information
if (points < 0) points = 0;
_score += points;
_scoreDisplay->setString(String::createWithFormat("%i",
_score)->getCString());
_timeBetweenPickups = 0;
}
When we collect _star , we activate the _pickup particle system on the spot
where _star was, we fill up the player's energy level, we make the game
slightly harder, and we immediately reset _star to its next position to be collec-
ted again.
The score is based on the time it took the player to collect _star .
6. And we keep track of this time on the last lines of update where we also check
the energy level:
_timeBetweenPickups += dt;
if (_lineContainer->getEnergy() == 0) {
if (_rocket->isVisible()) killPlayer();
}
Search WWH ::




Custom Search