Hope you like it!
Copy the code here and paste it into brickcc: (I don't know how to let you guys download it!)
//Start here:
byte brickx[25];
byte boardx;
float ballxspeed;
float bally;
float ballx;
bool brick[25];
float ballyspeed;
bool gameover;
byte b;
byte c;
task main()
{
MainDisplay:
ClearScreen();
TextOut(23, 32, "Break Out");
until(ButtonPressed(BTNCENTER, 0) == 1);
until(ButtonPressed(BTNCENTER, 0) == 0);
ballx = 50;
bally = 10;
ballxspeed = 0.1;
ballyspeed = -0.9;
boardx = 46;
b = 0;
repeat(25)
{
brick[b] = 0;
brickx[b] = b * 4;
b ++;
}
while(gameover = 1)
{
if(ButtonPressed(BTNLEFT, 0) == 1)
{
boardx -= 1;
}
if(ButtonPressed(BTNRIGHT, 0) == 1)
{
boardx += 1;
}
if(boardx <= 0)
{
boardx = 0;
}
if(boardx >= 90)
{
boardx = 90;
}
if(ballx >= 99)
{
ballxspeed = ballxspeed - ballxspeed - ballxspeed;
}
if(ballx <= 1)
{
ballxspeed = ballxspeed - ballxspeed - ballxspeed;
}
if(bally >= 63)
{
ballyspeed = ballyspeed - ballyspeed - ballyspeed;
}
if(bally <= 2 && ballx - boardx >= 0 && ballx - boardx <= 13)
{
ballyspeed = ballyspeed - ballyspeed - ballyspeed;
ballxspeed = (Random(18.0000) - 9) / 10;
if(ballxspeed <= 0)
{
ballyspeed = 1 - (ballxspeed - ballxspeed - ballxspeed);
}
else
{
ballyspeed = 1 - ballxspeed;
}
}
b = 0;
repeat(25)
{
if(brick[b] == 0 && ballx >= brickx[b] && ballx <= brickx[b] + 4 &&
bally >= 59 && bally <= 64)
{
brick[b] = 1;
}
b ++;
}
ClearScreen();
ballx += ballxspeed;
bally += ballyspeed;
CircleOut(ballx, bally, 1, DRAW_OPT_FILL_SHAPE );
LineOut(boardx, 0, boardx + 9, 0);
b = 0;
c = 0;
repeat(25)
{
if(brick[b] == 0)
{
RectOut(brickx[b], 59, 3, 3);
c ++;
}
b ++;
}
Wait(5);
if(c == 0)
{
goto YouWin;
}
if(bally <= 0)
{
goto YouLose;
}
}
YouWin:
ClearScreen();
TextOut(26, 32, "You Win!");
until(ButtonPressed(BTNCENTER, 0) == 1);
until(ButtonPressed(BTNCENTER, 0) == 0);
goto MainDisplay;
YouLose:
ClearScreen();
TextOut(17, 32, "You Lose...");
until(ButtonPressed(BTNCENTER, 0) == 1);
until(ButtonPressed(BTNCENTER, 0) == 0);
goto MainDisplay;
}
//End here
How to play:
Press right or left button to move the board.
Do not let the ball dropbelow the screen.
When all the bricks disappear, you win.
Watch the video at youtube:
Part 1: http://www.youtube.com/watch?v=Ie38EcaaPG8&feature=related
Part 2: http://www.youtube.com/watch?v=T5RzFtQ10jo&feature=related
Part 3: http://www.youtube.com/watch?v=SQe28ak0LXQ&feature=related
Part 4: http://www.youtube.com/watchv=RGBmqCqQYuA&feature=related
Some Pictures:

Be sure to check my new nxt game "node walker".The video is at http://www.youtube.com/watch?v=CnOL0iruo-M .

