📄 wallball.frm
字号:
Call WritePrivateProfileString(strsection$, UCase$(strkey$), strkeyvalue$, strfullpath$)
End Sub
Private Sub ball_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If Label1.Visible = True Or Label2.Visible = True Then
Label1.Visible = False
Label2.Visible = False
Timer1.Enabled = True
Else: Exit Sub
End If
End If
End Sub
Private Sub bouncer_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If Label1.Visible = True Or Label2.Visible = True Then
Label1.Visible = False
Label2.Visible = False
Timer1.Enabled = True
Else: Exit Sub
End If
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF7 Then
leveldone
End If
If KeyCode = vbKeyF8 Then
lives = 10
livesleft.Caption = "Lives: " & lives
End If
If KeyCode = vbKeyEscape Then
If Timer1.Enabled = False Then
Unload Me: Form2.Show
ReleaseCursor Me
Else: Exit Sub
End If
End If
End Sub
Public Sub Form_Load()
If FileExists(App.Path & "\brix.ini") Then
ballspeed = ReadINI("Settings", "Ballspeed", App.Path & "\brix.ini")
Form1.Caption = "Bricks 2000 v2.0, Ballspeed: " & ballspeed
End If
bricks = 50
bricksleft.Caption = "Bricks: " & 50
level = 1
Label4.Caption = "Level: " & level
score = 0
scorecard.Caption = "Score: " & score
lives = 2
livesleft.Caption = "Lives: " & lives
Label1.Visible = True
bouncer.Left = 3600
bouncer.Visible = True
ball.Top = bouncer.Top - bouncer.Height + 50
ball.Left = bouncer.Left - ball.Width / 2 + 770
ball.Visible = True
MovUD = -(ballspeed)
MovLR = (ballspeed)
Dim X As String
X = ReadINI("Skins", "Ball", App.Path & "\brix.ini")
If X = "1200" Then ball.Picture = Form10.Image2.Picture
If X = "1800" Then ball.Picture = Form10.Image3.Picture
If X = "2400" Then ball.Picture = Form10.Image4.Picture
If X = "3000" Then ball.Picture = Form10.Image6.Picture
If X = "3600" Then ball.Picture = Form10.Image7.Picture
If X = "4200" Then ball.Picture = Form10.Image8.Picture
Dim Y As String
Y = ReadINI("Skins", "Paddle", App.Path & "\brix.ini")
If Y = "Paddle1" Then bouncer.Picture = Form10.Image1.Picture
If Y = "Paddle2" Then bouncer.Picture = Form10.Image5.Picture
If Y = "Paddle3" Then bouncer.Picture = Form10.Image9.Picture
If Y = "Paddle4" Then bouncer.Picture = Form10.Image10.Picture
If Y = "Paddle5" Then bouncer.Picture = Form10.Image11.Picture
If Y = "Paddle6" Then bouncer.Picture = Form10.Image12.Picture
Unload Form10
If ballspeed < 10 Then points = 5
If ballspeed > 10 Then points = 10
If ballspeed > 20 Then points = 15
If ballspeed > 30 Then points = 20
If ballspeed > 40 Then points = 25
If ballspeed > 50 Then points = 30
If ballspeed > 60 Then points = 35
If ballspeed = 10 Then points = 5
If ballspeed = 20 Then points = 10
If ballspeed = 30 Then points = 15
If ballspeed = 40 Then points = 20
If ballspeed = 50 Then points = 25
If ballspeed = 60 Then points = 30
Call levels(level)
FormOnTop Me
scores10.Caption = ReadINI("Scores", "Score10", App.Path & "\brix.ini")
scores9.Caption = ReadINI("Scores", "Score9", App.Path & "\brix.ini")
scores8.Caption = ReadINI("Scores", "Score8", App.Path & "\brix.ini")
scores7.Caption = ReadINI("Scores", "Score7", App.Path & "\brix.ini")
scores6.Caption = ReadINI("Scores", "Score6", App.Path & "\brix.ini")
scores5.Caption = ReadINI("Scores", "Score5", App.Path & "\brix.ini")
scores4.Caption = ReadINI("Scores", "Score4", App.Path & "\brix.ini")
scores3.Caption = ReadINI("Scores", "Score3", App.Path & "\brix.ini")
scores2.Caption = ReadINI("Scores", "Score2", App.Path & "\brix.ini")
scores1.Caption = ReadINI("Scores", "Score1", App.Path & "\brix.ini")
tempscores.Caption = ReadINI("Scores", "Tempscore", App.Path & "\brix.ini")
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Timer1.Enabled = True Then Cancel = 1
ReleaseCursor Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
ReleaseCursor Me
Timer1.Enabled = False
Form2.Show
End Sub
Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
If Label1.Visible = True Or Label2.Visible = True Then
Label1.Visible = False
Label2.Visible = False
Timer1.Enabled = True
Else: Exit Sub
End If
End If
If Button = 2 Then
If Timer1.Enabled = True Then
Timer1.Enabled = False
Label3.Visible = True
Exit Sub
End If
If Label3.Visible = True Then
Timer1.Enabled = True
Label3.Visible = False
End If
End If
End Sub
Private Sub image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Label3.Visible = True Then Exit Sub
bouncer.Left = X - bouncer.Width / 2
If Timer1.Enabled = False Then
ball.Left = X - ball.Width / 2
End If
End Sub
Private Sub bouncer_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If ball.Tag = "" Then Exit Sub
MoveCursor ball.Tag, 300
End Sub
Public Sub Timer1_Timer()
Do
DoEvents
TrapCursor Me
ball.Top = ball.Top + MovUD
ball.Left = ball.Left + MovLR
For a = 0 To 49
'check bottom of the block
If MovUD < 0 Then
If block(a).Visible = True And ball.Top <= (block(a).Top + block(a).Height) And ball.Top >= block(a).Top And (ball.Left + ball.Width / 2) <= (block(a).Left + block(a).Width) And (ball.Left + ball.Width / 2) >= block(a).Left Then
MovUD = (ballspeed)
Call blockhit(block(a))
End If
End If
'check top of the block
If MovUD > 0 Then
If block(a).Visible = True And (ball.Top + ball.Height) >= block(a).Top And (ball.Top + ball.Height) <= (block(a).Top + block(a).Height) And (ball.Left + ball.Width / 2) <= (block(a).Left + block(a).Width) And (ball.Left + ball.Width / 2) >= block(a).Left Then
MovUD = -(ballspeed)
Call blockhit(block(a))
End If
End If
'check left of the block
If MovLR > 0 Then
If block(a).Visible = True And (ball.Left + ball.Width) >= block(a).Left And (ball.Left + ball.Width) <= (block(a).Left + block(a).Width) And (ball.Top + ball.Height / 2) <= (block(a).Top + block(a).Height) And (ball.Top + ball.Height / 2) >= block(a).Top Then
MovLR = -(ballspeed)
Call blockhit(block(a))
End If
End If
'check right of the block
If MovLR < 0 Then
If block(a).Visible = True And ball.Left <= (block(a).Left + block(a).Width) And ball.Left >= block(a).Left And (ball.Top + ball.Height / 2) <= (block(a).Top + block(a).Height) And (ball.Top + ball.Height / 2) >= block(a).Top Then
MovLR = (ballspeed)
Call blockhit(block(a))
End If
End If
Next a
If ball.Top < 0 Then MovUD = (ballspeed)
If ball.Left < 2 Then MovLR = (ballspeed)
If ball.Left > Form1.Width - ball.Width - 50 Then MovLR = -(ballspeed)
If (ball.Top + ball.Height) > bouncer.Top - 10 And (ball.Left + ball.Width) > bouncer.Left And ball.Left + ball.Width / 2 = (bouncer.Left + bouncer.Width / 2) Then
MovUD = -(ballspeed)
MovLR = (ballspeed)
End If
If (ball.Top + ball.Height) > bouncer.Top - 10 And (ball.Left + ball.Width) > bouncer.Left - 100 And ball.Left + ball.Width / 2 < (bouncer.Left + bouncer.Width / 4) Then
MovUD = -(ballspeed)
MovLR = -(ballspeed) - 10
End If
If (ball.Top + ball.Height) > bouncer.Top - 10 And (ball.Left + ball.Width) > bouncer.Left - 100 And ball.Left + ball.Width / 2 < (bouncer.Left + bouncer.Width / 4 * 2) And ball.Left + ball.Width / 2 > (bouncer.Left + bouncer.Width / 4) Then
MovUD = -(ballspeed)
MovLR = -(ballspeed)
End If
If (ball.Top + ball.Height) > bouncer.Top - 10 And ball.Left < (bouncer.Left + bouncer.Width) - 100 And ball.Left + ball.Width / 2 < (bouncer.Left + bouncer.Width / 4 * 3) And ball.Left + ball.Width / 2 > (bouncer.Left + bouncer.Width / 4 * 2) Then
MovUD = -(ballspeed)
MovLR = (ballspeed)
End If
If (ball.Top + ball.Height) > bouncer.Top - 10 And ball.Left < (bouncer.Left + bouncer.Width) - 100 And ball.Left + ball.Width / 2 < (bouncer.Left + bouncer.Width / 4 * 4) And ball.Left + ball.Width / 2 > (bouncer.Left + bouncer.Width / 4 * 3) Then
MovUD = -(ballspeed)
MovLR = (ballspeed) + 10
End If
If (ball.Top + ball.Height) > bouncer.Top + 300 Then deathhascome
If lives = -1 Then: endofgame: Exit Do
If bricks = 0 Then: leveldone: Exit Do
ReleaseCursor Me
Loop Until Timer1.Enabled = False
End Sub
Public Sub blockhit(block As Object)
block.Visible = False
bricks = bricks - 1
bricksleft.Caption = "Bricks: " & bricks
score = score + points
scorecard.Caption = "Score: " & score
End Sub
Public Sub endofgame()
bouncer.Visible = False
ball.Visible = False
tempscores.Caption = score
livesleft.Caption = "Lives: 0"
checkhighscore
Timer1.Enabled = False
Label2.Visible = False
ReleaseCursor Me
Form4.Show
Call death(score)
Form1.Enabled = False
End Sub
Public Sub leveldone()
Timer1.Enabled = False
ball.Visible = False
score = score + 50
scorecard.Caption = "Score: " & score
level = level + 1
Label4.Caption = "Level: " & level
bricks = 50
bricksleft.Caption = "Bricks: " & bricks
ball.Top = bouncer.Top - bouncer.Height + 50
ball.Left = bouncer.Left - ball.Width / 2 + 770
Label2.Visible = False
Label3.Visible = False
Label1.Visible = False
MovUD = -(ballspeed)
MovLR = (ballspeed)
ball.Visible = True
If level = 6 Then
tempscores.Caption = score
checkhighscore
Timer1.Enabled = False
Label2.Visible = False
lives = 0
livesleft.Caption = "Lives: " & lives
ReleaseCursor Me
Form4.Show
Call death(score)
Form1.Enabled = False
End If
Call levels(level)
End Sub
Public Sub deathhascome()
Label2.Visible = True
Timer1.Enabled = False
score = score - 50
scorecard.Caption = "Score: " & score
lives = lives - 1
livesleft.Caption = "Lives: " & lives
ball.Top = bouncer.Top - bouncer.Height + 50
ball.Left = bouncer.Left - ball.Width / 2 + 770
MovUD = -(ballspeed)
MovLR = (ballspeed)
End Sub
Public Sub changebrickcount()
If level = 4 Then
bricks = 48
bricksleft.Caption = "Bricks: " & bricks
End If
End Sub
Public Sub checkhighscore()
Dim score1, score2, score3, score4, score5, score6, score7, score8, score9, score10, tempscore As Integer
Call WriteINI("Scores", "TempScore", tempscores.Caption, App.Path & "\brix.ini")
score10 = ReadINI("Scores", "Score10", App.Path & "\brix.ini")
score9 = ReadINI("Scores", "Score9", App.Path & "\brix.ini")
score8 = ReadINI("Scores", "Score8", App.Path & "\brix.ini")
score7 = ReadINI("Scores", "Score7", App.Path & "\brix.ini")
score6 = ReadINI("Scores", "Score6", App.Path & "\brix.ini")
score5 = ReadINI("Scores", "Score5", App.Path & "\brix.ini")
score4 = ReadINI("Scores", "Score4", App.Path & "\brix.ini")
score3 = ReadINI("Scores", "Score3", App.Path & "\brix.ini")
score2 = ReadINI("Scores", "Score2", App.Path & "\brix.ini")
score1 = ReadINI("Scores", "Score1", App.Path & "\brix.ini")
tempscore = ReadINI("Scores", "Tempscore", App.Path & "\brix.ini")
scores1.Caption = score1
scores2.Caption = score2
scores3.Caption = score3
scores4.Caption = score4
scores5.Caption = score5
scores6.Caption = score6
scores7.Caption = score7
scores8.Caption = score8
scores9.Caption = score9
scores10.Caption = score10
tempscores.Caption = tempscore
If tempscore = score1 Then Exit Sub
If tempscore = score2 Then Exit Sub
If tempscore = score3 Then Exit Sub
If tempscore = score4 Then Exit Sub
If tempscore = score5 Then Exit Sub
If tempscore = score6 Then Exit Sub
If tempscore = score7 Then Exit Sub
If tempscore = score8 Then Exit Sub
If tempscore = score9 Then Exit Sub
If tempscore = score10 Then Exit Sub
If tempscore = 0 Then Exit Sub
If tempscore < 0 Then Exit Sub
If tempscore >= score1 Then
Me.Tag = "score1"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", scores7.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score7", scores6.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score6", scores5.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score5", scores4.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score4", scores3.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score3", scores2.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score2", scores1.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score1", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score2 Then
Me.Tag = "score2"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", scores7.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score7", scores6.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score6", scores5.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score5", scores4.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score4", scores3.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score3", scores2.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score2", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score3 Then
Me.Tag = "score3"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", scores7.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score7", scores6.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score6", scores5.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score5", scores4.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score4", scores3.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score3", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score4 Then
Me.Tag = "score4"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", scores7.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score7", scores6.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score6", scores5.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score5", scores4.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score4", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score5 Then
Me.Tag = "score5"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", scores7.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score7", scores6.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score6", scores5.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score5", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score6 Then
Me.Tag = "score6"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", scores7.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score7", scores6.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score6", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score7 Then
Me.Tag = "score7"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", scores7.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score7", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score8 Then
Me.Tag = "score8"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", scores8.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score8", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score9 Then
Me.Tag = "score9"
Call WriteINI("Scores", "Score10", scores9.Caption, App.Path & "\brix.ini")
Call WriteINI("Scores", "Score9", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
If tempscore >= score10 Then
Me.Tag = "score10"
Call WriteINI("Scores", "Score10", tempscores.Caption, App.Path & "\brix.ini")
Exit Sub
End If
End Sub
Private Sub Timer2_Timer()
GetCursorPosition
ball.Tag = XPos
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -