The Flash Game project taught us about coding. We had to create a customized game out of a template. For our template we chose brick breaker. In our game, he ball gets faster as it hits the wall. This adds more challenge to the game and makes it more addicting for the player. This game was ver difficult at parts because any times our tutorial would not tell us what to do or where to place certain codes. This caused us to just barely finish before the deadline and could have broke our game. In the end, the games works very well and smoothly (with the exception of the new game glitch).
This code decided how fast the ball went in the beginning of each level. We lowered the initial speed so the speed could increase without becoming too fast too quickly.
//These variables are needed for moving the ball
var ballXSpeed:Number = 4; //X Speed of the Ball
var ballYSpeed:Number = 4; //Y Speed of the Ball
This Code made the ball start to move faster when it bounced off a side wall. It adds 1 to the X speed of the ball.
if(mcBall.x <= 0){
//if the ball hits the left side
//of the screen, then bounce off
ballXSpeed *= -1;
ballXSpeed = ballXSpeed += 1;
This code add 1 to the Y speed of the ball when it hits the top wall of the game.
if(mcBall.y <= 0){
//if the ball hits the top
//then bounce down
ballYSpeed *= -1;
ballYSpeed = ballYSpeed += 1;
}
This code makes the initial speed of the ball at the start of the level faster for every level the player beats.
function checkLevel(event:Event):void{
//checking if the bricks are all gone
if(brickAmt == 0){
//reset the level by increasing the level
currentLvl ++;
ballYSpeed = 4;
ballXSpeed = 4;
ballYSpeed= ballYSpeed += 1;
ballXSpeed = ballXSpeed += 1;
This code decided how fast the ball went in the beginning of each level. We lowered the initial speed so the speed could increase without becoming too fast too quickly.
//These variables are needed for moving the ball
var ballXSpeed:Number = 4; //X Speed of the Ball
var ballYSpeed:Number = 4; //Y Speed of the Ball
This Code made the ball start to move faster when it bounced off a side wall. It adds 1 to the X speed of the ball.
if(mcBall.x <= 0){
//if the ball hits the left side
//of the screen, then bounce off
ballXSpeed *= -1;
ballXSpeed = ballXSpeed += 1;
This code add 1 to the Y speed of the ball when it hits the top wall of the game.
if(mcBall.y <= 0){
//if the ball hits the top
//then bounce down
ballYSpeed *= -1;
ballYSpeed = ballYSpeed += 1;
}
This code makes the initial speed of the ball at the start of the level faster for every level the player beats.
function checkLevel(event:Event):void{
//checking if the bricks are all gone
if(brickAmt == 0){
//reset the level by increasing the level
currentLvl ++;
ballYSpeed = 4;
ballXSpeed = 4;
ballYSpeed= ballYSpeed += 1;
ballXSpeed = ballXSpeed += 1;