Introduction
This is an old game, first implemented in 1996 or so... It has a great addictive power. You will quickly find out the rules. I used the winmm.dll library for playing sounds, the picturebox.Paint event to draw bitmaps in a Picturebox and a recursive function to check the balls next to each other for the colors. And some more stuff...
private void pictureBox1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
for(int i = 0; i < 8; i++)
{
for(int j = 0; j < 12; j++)
{
if(engine._ball[i, j]._exists)
{
//g.FillEllipse(_color[engine._ball[i, j]._icolor], i * 24, j * 24, 24, 24);
g.DrawImage(_bmp[engine._ball[i, j]._icolor],
(i * 24) - _posx * engine._ball[i, j]._yvel, (j * 24) + _posy * engine._ball[i, j]._vel, 24, 24);
}
if(engine._ball[i, j]._isDisappearing)
{
g.DrawImage(_bmp[engine._ball[i, j]._icolor],
(i * 24) + _var, (j * 24) + _var, 24 - (_var*2), 24 - (_var*2));
}
}
}
if((_gameover) && (!_gamewon))
{
g.DrawString("GAME OVER", new Font("Arial", 20), System.Drawing.Brushes.Black,
new Point(10, 122));
g.DrawString("GAME OVER", new Font("Arial", 20), System.Drawing.Brushes.White,
new Point(8, 120));
}
if(_gamewon)
{
g.DrawString("GAME WON", new Font("Arial", 20, System.Drawing.FontStyle.Bold),
System.Drawing.Brushes.Black, new Point(10, 122));
g.DrawString("GAME WON", new Font("Arial", 20, System.Drawing.FontStyle.Bold),
System.Drawing.Brushes.LightBlue, new Point(8, 120));
}
}