Thanks guys!
Yeah it's a bit easy, so I widened the slot at the bottom and took your advice Delsus and made it a little wider for every level, thanks!
I also made the slot not disappear into the side on the right side and it starts out with only 2 balls instead of 3.
Plus I added a Game Over at the end and the ability to start over and increased the maximum balls played at one time to 15 (although the most I've seen so far is 6).
I also cleared some variables for each level so you won't get as many balls and also lessened the chance of getting more.
Yeah it's a bit easy, so I widened the slot at the bottom and took your advice Delsus and made it a little wider for every level, thanks!
I also made the slot not disappear into the side on the right side and it starts out with only 2 balls instead of 3.
Plus I added a Game Over at the end and the ability to start over and increased the maximum balls played at one time to 15 (although the most I've seen so far is 6).
I also cleared some variables for each level so you won't get as many balls and also lessened the chance of getting more.
Code: (Select All)
'Brick Smasher 3 by SierraKen
'Made on Feb. 27, 2025
'Use your mouse to bounce the balls to break the bricks.
'Collect the different texts that come down when you break the bricks.
'The texts described at the start.
'This is a freeware game.
'Any similar name is completely coincidental and not intended.
Randomize Timer
Screen _NewImage(800, 600, 32)
num = 126
Dim brickx(num), bricky(num), size(num), red(num), green(num), blue(num)
Dim bpoints(num), ba(num)
Dim px(20), py(20), pa(20), pc(20) As _Unsigned Long
Dim super(num), superduper(20)
Dim c As Long
main:
Cls
level = 1
score = 0
ball = 2
speed = 3 ' Speed of ball
snd = 900
slotwide = 450
For yyy = 10 To 440 Step 20
_Limit 300
Randomize Timer
sz = Int(Rnd * 50) + 10
Randomize Timer
xxx = Int(Rnd * 570) + 10
Randomize Timer
c = Int(Rnd * 225) + 30
Randomize Timer
c2 = Int(Rnd * 225) + 30
Randomize Timer
c3 = Int(Rnd * 225) + 30
Circle (xxx, yyy), sz, _RGB32(c, c2, c3)
Paint (xxx, yyy), _RGB32(c, c2, c3), _RGB32(c, c2, c3)
_Delay .1
snd = snd - 10
Sound snd, .25
Circle (xxx, yyy), sz, _RGB32(0, 0, 0)
Paint (xxx, yyy), _RGB32(0, 0, 0)
Next yyy
Sound 100, .5
_PrintString (284, 50), "B R I C K S M A S H E R 3"
_PrintString (352, 80), "By SierraKen"
_Delay 2
Cls
Print: Print: Print
Print " Use the mouse to move the paddle,"
Print " to hit the balls to break the bricks."
Print
Print " 500: 500 points added."
Print " More: An added ball to use."
Print " Super: A red ball that goes through the bricks."
Print
Print " Esc: Quits at anytime."
Print: Print: Print: Print
Print " Press left mouse button to begin!"
Do: While _MouseInput: Wend: Loop Until _MouseButton(1)
Cls
begin:
slotx = 10
sloty = 590
dir = 1
b = 0
hit = 0
balls = 1
c = _RGB32(255, 0, 0)
For clr = 1 To 5
superduper(clr) = 0
Next clr
For clr = 1 To num
bpoints(clr) = 0
ba(clr) = 0
super(clr) = 0
Next clr
time2 = 0: time4 = 0: time6 = 0: time100 = 0: time101 = 0
For bb = 60 To 320 Step 20
For b2 = 50 To 740 Step 40
b = b + 1
If b > num Then GoTo nex:
bricky(b) = bb
brickx(b) = b2
size(b) = 50
red(b) = Rnd * 155
red(b) = red(b) + 100
green(b) = Rnd * 155
green(b) = green(b) + 100
blue(b) = Rnd * 155
blue(b) = blue(b) + 100
bonus = Int(Rnd * 100) + 1
If bonus > 95 Then bpoints(b) = 1
bl = Int(Rnd * 100) + 1
If bl > 98 Then ba(b) = 1
sup = Int(Rnd * 100 + 1)
If sup > 98 Then super(b) = 1
Next b2
Next bb
nex:
' thses remain constant
px = 350: py = 250: pr = 5 ' <<<< label everything of ball with p
mr = 80 ' <<<< Radius of paddle. Everything that starts with m is the mouse paddle.
start:
px(1) = 400: py(1) = 300
Cls
pa(1) = _Pi(2) * Rnd ' pa = ball angle this is rnd times all directions 0 to 360 in degrees 0 to 2*pi in radians
Play "mb"
_Title "Score: " + Str$(score) + " Level: " + Str$(level) + " Ball: " + Str$(ball)
Do
_Limit 80
Line (10, 10)-(790, 590), _RGB32(255, 255, 255), B
For b = 1 To num
Line (brickx(b), bricky(b))-(brickx(b) + 20, bricky(b) + 10), _RGB32(red(b), green(b), blue(b)), BF
a$ = InKey$
If a$ = " " Then GoTo start:
If a$ = Chr$(27) Then End
While _MouseInput: Wend
mx = _MouseX
my = _MouseY
Line (mx, my)-(mx + mr, my + 10), c, BF
If balls > 15 Then balls = 15
For d = 1 To balls
'Detect ball collision with bricks.
If px(d) > brickx(b) And px(d) < brickx(b) + 22 And py(d) > bricky(b) And py(d) < bricky(b) + 12 Then
If superduper(d) = 1 Then GoTo through
If Sin(pa(d)) > 0 Then ' Ball is moving downward
py(d) = bricky(b) - 4 ' Move ball just above the paddle
Else ' Ball is moving upward (hitting bottom of paddle)
py(d) = bricky(b) + 14 ' Move ball just below the paddle
End If
'pa(d) = -pa(d)
pa(d) = _Atan2(py(d) - bricky(b), px(d) - brickx(b))
px(d) = px(d) + speed * Cos(pa(d))
py(d) = py(d) + speed * Sin(pa(d))
through:
score = score + 10
Sound 600, 1, , , 4, 5
_Title "Score: " + Str$(score) + " Level: " + Str$(level) + " Ball: " + Str$(ball)
hit = hit + 1
If bpoints(b) = 1 Then
bbx2 = brickx(b): bby2 = bricky(b)
time2 = 1000
Sound 700, 1, , , 4, 5
Sound 725, 1, , , 4, 5
Sound 750, 1, , , 4, 5
Sound 775, 1, , , 4, 5
Sound 800, 1, , , 4, 5
End If
If ba(b) = 1 And balls < 15 Then
bbx3 = brickx(b): bby3 = bricky(b)
time5 = 1000
Sound 700, 1, , , 4, 5
Sound 725, 1, , , 4, 5
Sound 750, 1, , , 4, 5
Sound 775, 1, , , 4, 5
Sound 800, 1, , , 4, 5
End If
If super(b) = 1 And balls < 15 Then
bbx4 = brickx(b): bby4 = bricky(b)
time100 = 1000
Sound 700, 1, , , 4, 5
Sound 725, 1, , , 4, 5
Sound 750, 1, , , 4, 5
Sound 775, 1, , , 4, 5
Sound 800, 1, , , 4, 5
End If
If hit = num Then
level = level + 1
speed = speed + .25
slotwide = slotwide + 25
If slotwide > 790 Then slotwide = 790
If speed > 8 Then speed = 8
GoTo begin:
End If
brickx(b) = -100: bricky(b) = -100
End If
Next d
Next b
If time2 > 0 Then
time2 = time2 - 1
bby2 = bby2 + .5
_PrintString (bbx2, bby2), "500"
End If
If time2 > 0 Then
If bbx2 > mx And bbx2 < mx + mr And bby2 > my And bby2 < my + 20 Then
time2 = 0
score = score + 500
Sound 900, 1, , , 4, 5
Sound 925, 1, , , 4, 5
Sound 950, 1, , , 4, 5
Sound 975, 1, , , 4, 5
Sound 1000, 1, , , 4, 5
time4 = 1000
c = _RGB32(0, 255, 0)
bbx2 = -100: bby2 = -100
End If
End If
If time4 > 0 Then
time4 = time4 - 1
If time4 < 5 Then c = _RGB32(255, 0, 0)
End If
If time5 > 0 Then
time5 = time5 - 1
bby3 = bby3 + .5
_PrintString (bbx3 - 8, bby3), "More"
End If
If time5 > 0 Then
If bbx3 > mx And bbx3 < mx + mr And bby3 > my And bby3 < my + 20 Then
time5 = 0
balls = balls + 1
If balls > 5 Then balls = 5
ball = ball + 1
_Title "Score: " + Str$(score) + " Level: " + Str$(level) + " Ball: " + Str$(ball)
Sound 900, 1, , , 4, 5
Sound 925, 1, , , 4, 5
Sound 950, 1, , , 4, 5
Sound 975, 1, , , 4, 5
Sound 1000, 1, , , 4, 5
time6 = 1000
c = _RGB32(255, 255, 255)
bbx3 = -100: bby3 = -100
pa(d) = _Pi(2) * Rnd
End If
End If
If time6 > 0 Then
time6 = time6 - 1
If time6 < 5 Then c = _RGB32(255, 0, 0)
End If
If time100 > 0 Then
time100 = time100 - 1
bby4 = bby4 + .5
_PrintString (bbx4 - 8, bby4), "Super"
End If
If time100 > 0 Then
If bbx4 > mx And bbx4 < mx + mr And bby4 > my And bby4 < my + 20 Then
time100 = 0
balls = balls + 1
ball = ball + 1
_Title "Score: " + Str$(score) + " Level: " + Str$(level) + " Ball: " + Str$(ball)
Sound 900, 1, , , 4, 5
Sound 925, 1, , , 4, 5
Sound 950, 1, , , 4, 5
Sound 975, 1, , , 4, 5
Sound 1000, 1, , , 4, 5
time101 = 1000
c = _RGB32(255, 255, 133)
bbx4 = -100: bby4 = -100
pa(d) = _Pi(2) * Rnd
superduper(d) = 1
pc(d) = _RGB32(255, 0, 0)
End If
End If
If time101 > 0 Then
time101 = time101 - 1
If time101 < 5 Then c = _RGB32(255, 0, 0)
End If
For d = 1 To balls
'Detect ball collision with paddle.
If px(d) > mx And px(d) < mx + mr And py(d) > my - 1 And py(d) < my + 11 Then
If Sin(pa(d)) > 0 Then ' Ball is moving downward
py(d) = my - 1 ' Move ball just above the paddle
Else ' Ball is moving upward (hitting bottom of paddle)
py(d) = my + 21 ' Move ball just below the paddle
End If
pa(d) = -pa(d) * ((Rnd / 10) + 1)
If ti > 0 Then ti = ti - 1: GoTo skip2
Sound 400, 1, , , 4, 5
ti = 2
skip2:
If py(d) + pr >= my - 1 And px(d) > mx - 1 And px(d) < mx + mr + 1 Then
py(d) = my - pr ' Prevents it from getting inside the paddle
End If
End If
'keep ball out of wall = wall boundary +- radius of puck
If px(d) > 790 - pr Then pa(d) = _Pi - pa(d): px(d) = 790 - pr: Sound 400, 1, , , 4, 5
If px(d) < 10 + pr Then pa(d) = _Pi - pa(d): px(d) = 10 + pr: Sound 400, 1, , , 4, 5
If py(d) > 590 - pr Then pa(d) = -pa(d): py(d) = 590 - pr: Sound 400, 1, , , 4, 5
If py(d) < 10 + pr Then pa(d) = -pa(d): py(d) = 10 + pr: Sound 400, 1, , , 4, 5
' nove the ball
px(d) = px(d) + speed * Cos(pa(d))
py(d) = py(d) + speed * Sin(pa(d))
'Empty slot at the bottom to keep ball away from.
If px(d) > slotx And px(d) < slotx + slotwide And py(d) > sloty - 11 Then
ball = ball - 1
_Title "Score: " + Str$(score) + " Level: " + Str$(level) + " Ball: " + Str$(ball)
px(d) = -200: py(d) = 900
'If superduper(d) = 1 Then superduper(d) = 0
If balls > 1 Then balls = balls - 1
If ball = 0 Then
_AutoDisplay
_PrintString (336, 300), "G a m e O v e r"
_PrintString (336, 332), "Play Again (Y/N)"
Do
yn$ = InKey$
If yn$ = "y" Or yn$ = "Y" Then GoTo main
If yn$ = "n" Or yn$ = "N" Then End
If yn$ = " " Then GoTo main
If yn$ = Chr$(27) Then End
Loop
End If
End If
If slotx > 790 - slotwide Then dir = 2
If slotx < 10 Then dir = 1
If dir = 1 Then slotx = slotx + 1
If dir = 2 Then slotx = slotx - 1
Line (slotx, sloty)-(slotx + slotwide, sloty), _RGB32(0, 0, 0)
If superduper(d) = 1 Then
pc(d) = _RGB32(255, 0, 0)
Else
pc(d) = _RGB32(0, 255, 0)
End If
fillCircle px(d), py(d), pr, pc(d) ' draw ball
Next d
_Display
Cls
Loop
'from Steve Gold standard
Sub fillCircle (CX As Integer, CY As Integer, R As Integer, C As _Unsigned Long)
Dim Radius As Integer, RadiusError As Integer
Dim X As Integer, Y As Integer
Radius = Abs(R): RadiusError = -Radius: X = Radius: Y = 0
If Radius = 0 Then PSet (CX, CY), C: Exit Sub
Line (CX - X, CY)-(CX + X, CY), C, BF
While X > Y
RadiusError = RadiusError + Y * 2 + 1
If RadiusError >= 0 Then
If X <> Y + 1 Then
Line (CX - Y, CY - X)-(CX + Y, CY - X), C, BF
Line (CX - Y, CY + X)-(CX + Y, CY + X), C, BF
End If
X = X - 1
RadiusError = RadiusError - X * 2
End If
Y = Y + 1
Line (CX - X, CY - Y)-(CX + X, CY - Y), C, BF
Line (CX - X, CY + Y)-(CX + X, CY + Y), C, BF
Wend
End Sub