void object::applyGravity() { speed += acceleration + gravity; acceleration.clear(); for( u8 i = 0; i < (1 << 3); i += 1) { checkGround(); checkSides(); position += (speed / 8); } }
void Breakout::checkCollision(){ // if a brick is hit if(level[7-ball.y][ball.x] == 'B'){ bricks--; } else if(ball.y <= 1){ // if ball is in paddle, move above if(level[7-ball.y][ball.x] == 'P'){ ball.y++; } // if the paddle is hit if(level[7-ball.y+1][ball.x] == 'P'){ hitPaddle(); } checkSides(); } }