diff --git a/main.go b/main.go index 87f681d..44192f1 100644 --- a/main.go +++ b/main.go @@ -44,6 +44,7 @@ type brick struct { x, y, width, height float64 active bool color color.Color + score int } func (g *Game) init() { @@ -64,13 +65,16 @@ func (g *Game) init() { size: ballSize, } - // Rainbow colors for the bricks - rainbowColors := []color.Color{ - color.RGBA{0xff, 0x00, 0x00, 0xff}, // Red - color.RGBA{0xff, 0x7f, 0x00, 0xff}, // Orange - color.RGBA{0xff, 0xff, 0x00, 0xff}, // Yellow - color.RGBA{0x00, 0xff, 0x00, 0xff}, // Green - color.RGBA{0x00, 0x00, 0xff, 0xff}, // Blue + // Rainbow colors and scores for the bricks + brickConfig := []struct { + color color.Color + score int + }{ + {color.RGBA{0xff, 0x00, 0x00, 0xff}, 50}, // Red (top row) - highest score + {color.RGBA{0xff, 0x7f, 0x00, 0xff}, 40}, // Orange + {color.RGBA{0xff, 0xff, 0x00, 0xff}, 30}, // Yellow + {color.RGBA{0x00, 0xff, 0x00, 0xff}, 20}, // Green + {color.RGBA{0x00, 0x00, 0xff, 0xff}, 10}, // Blue (bottom row) - lowest score } // Initialize bricks @@ -83,7 +87,8 @@ func (g *Game) init() { width: brickWidth, height: brickHeight, active: true, - color: rainbowColors[row], + color: brickConfig[row].color, + score: brickConfig[row].score, }) } } @@ -154,7 +159,7 @@ func (g *Game) Update() error { g.ball.y <= g.bricks[i].y+g.bricks[i].height { g.bricks[i].active = false g.ball.dy = -g.ball.dy - g.score += 10 + g.score += g.bricks[i].score } }