Example #1
0
int quickScore(Config &config, vector<long> &locs, int center_index, vector<int> &offsets, int num_approx_hits, int num_hits) {

	if(num_approx_hits == 1) {
		return config.BASE_SCORE;
	}

	int x = config.BASE_SCORE + scoreLeft(config, locs, center_index)+
		scoreRight(config, locs, center_index, num_hits) - center_index;

	int y = config.Y_SCORE_MULT * scoreY(config, locs, center_index, offsets);
	return x+y;
}
void GameLayer::onCollision(CollisionManager::Type type, const Point& point) {
  switch (type) {
    case CollisionManager::Type::BALL_WITH_PADDLE_LEFT:
    case CollisionManager::Type::BALL_WITH_PADDLE_RIGHT:
      playSoundCollision();
      emitParticles(point);
      increaseVelocity();
      break;
    case CollisionManager::Type::BALL_WITH_GOAL_LEFT:
      playSoundPoint();
      scoreRight();
      restartToLeft();
      break;
    case CollisionManager::Type::BALL_WITH_GOAL_RIGHT:
      playSoundPoint();
      scoreLeft();
      restartToRight();
      break;
    default:
      playSoundCollision();
      emitParticles(point);
      break;
  }
}