模仿是个开始

模仿金山拯救苹果游戏,效果差很多,等待下一步完善~~

效果

查看效果

窗体布局

 

 

 

 

 

 

相关文档用于美化,还没有完成~~

启动窗体为form2

代码

模块

Option Explicit
Public a As String, b As String, c As String
Public longLeft As Long
Public HS1value As Single
Public HS2value As String
Public Sub subone()
    Randomize
    a = Chr(Int(Rnd * 26 + 97))
    longLeft = Int(Rnd * (Form1.ScaleWidth - 500))
End Sub
Public Sub subtwo()
    Randomize
    b = Chr(Int(Rnd * 26 + 97))
    longLeft = Int(Rnd * (Form1.ScaleWidth - 500))
End Sub
Public Sub subthr()
    Randomize
    c = Chr(Int(Rnd * 26 + 97))
    longLeft = Int(Rnd * (Form1.ScaleWidth - 500))
End Sub


form1

Option Explicit
Dim numcount As Integer
Private Sub Form_KeyPress(KeyAscii As Integer)

    Select Case KeyAscii
        Case Asc(Label1.Caption)
            Label1.Top = -Label1.Height
            Call subone
            Label1.Left = longLeft
            Label1.Caption = a
        Case Asc(Label2.Caption)
            Label2.Top = -Label2.Height
            Call subtwo
            Label2.Left = longLeft
            Label2.Caption = b
        Case Asc(Label3.Caption)
            Label3.Top = -Label3.Height
            Call subthr
            Label3.Left = longLeft
            Label3.Caption = c
     End Select
        

End Sub

Private Sub Form_Load()
    
    Label1.Visible = True
    Label2.Visible = True
    Label3.Visible = True
    
    Timer1.Enabled = True
    Timer2.Enabled = True
    Timer3.Enabled = True
    
    Timer1.Interval = Val((10 - Val(HS1value)) * 8)
    Timer2.Interval = Val((10 - Val(HS1value)) * 15)
    Timer3.Interval = Val((10 - Val(HS1value)) * 20)
    
    Label1.Top = -Label1.Height
    Label2.Top = -Label2.Height
    Label3.Top = -Label3.Height

    Call subone
    Call subtwo
    Call subthr
    Label1.Caption = a
    Label2.Caption = b
    Label3.Caption = c

End Sub




Private Sub Timer1_Timer()
    
    Label1.Top = Label1.Top + 50

    If Label1.Top > Form1.ScaleHeight Then
        Label1.Top = -Label1.Height

        numcount = numcount + 1
        Lbl5.Caption = Str(numcount)
    End If
End Sub

Private Sub Timer2_Timer()
   
    Label2.Top = Label2.Top + 250

    If Label2.Top > Form1.ScaleHeight Then
        Label2.Top = -Label2.Height

        numcount = numcount + 1
        Lbl5.Caption = Str(numcount)
    End If
End Sub

Private Sub Timer3_Timer()
   
    Label3.Top = Label3.Top + 125

    If Label3.Top > Form1.ScaleHeight Then
        Label3.Top = -Label3.Height
        numcount = numcount + 1
        Lbl5.Caption = Str(numcount)
    End If
    
End Sub


 

form2

Option Explicit

Private Sub Command1_Click()
    Form2.Hide
    Form1.Show
End Sub

Private Sub Command2_Click()
    End
End Sub

Private Sub play_Click()
    Form4.Show
End Sub

Private Sub quit_Click()
   End
End Sub

Private Sub setting_Click()
   Form3.Show
End Sub


 

form3

Option Explicit

Private Sub Command1_Click()
    Form3.Hide
    HS1value = HS1.Value
    HS2value = HS2.Value
    
End Sub

Private Sub Command2_Click()
    Form3.Hide
    
End Sub


 

form4

Option Explicit

Private Sub Image1_Click()
    Form2.Show
    Form4.Hide
End Sub

Private Sub Image2_Click()
    Form1.Show
    Form4.Hide
End Sub



 

 


评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值