⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 playing.frm

📁 [原创]非常耐玩的足球小游戏
💻 FRM
📖 第 1 页 / 共 5 页
字号:
save_file
End Sub


Private Sub Timer1_Timer()
friend_go
enemy_go
'friend move
If puckx - fri1.Left >= 0 Then
    friend_move ("Right")
End If
If fri1.Left - puckx >= 0 Then
    friend_move ("Left")
End If
If fri1.Top < pucky Then
    friend_move ("down")
End If
If fri1.Top > pucky Then
    friend_move ("up")
End If
'end of friend move
'enemy move
If puckx > ene1.Left Then
enemy_move ("right")
End If
If puckx < ene1.Left Then
enemy_move ("left")
End If
If pucky > ene1.Top And ene1.Top < 2000 Then
enemy_move ("down")
End If
If pucky < ene1.Top And ene1.Top > 400 Then
enemy_move ("up")
End If
'end of enemy move
'This part is the main
On Error Resume Next
Dim a As Single
touche = False
touche1 = False
'goals and touch
If gagne = True Then
    vpuckx = 0
    vpucky = 0
    If pucky < 100 Then
        Scorered.Caption = Scorered.Caption + 1
           rp = rp + 1
           'tip
           addtip ("Oh," + namep.Caption + " goals!")
        r.Caption = rp
        If rp = mp Then
        additionpp = additionpp + 50
        yz
        mp = mp * 2
        MsgBox "Level Up!", , "Game Message"
          If mp = 160 Then
          MsgBox "Congratulations!You're team have level up!", , "Team Level Up"
          mp = 6
          rp = 0
          End If
        End If
        r.Caption = rp
        m.Caption = mp
        additionp.Caption = additionpp
        MsgBox max(Scorered.Caption, Scoreblue.Caption) & " to " & min(Scorered.Caption, Scoreblue.Caption), vbDefaultButton1, "Red goal"
        paddle2.Top = 480
        paddle2.Left = 3840
        Else
        Scoreblue.Caption = Scoreblue.Caption + 1
        MsgBox max(Scorered.Caption, Scoreblue.Caption) & " to " & min(Scorered.Caption, Scoreblue.Caption), vbDefaultButton1, "Blue goal"
        paddle2.Left = 3690
        paddle2.Top = 600
        'tip
        addtip ("Oh!what come ture!the computer goals!")
    End If
    puckx = 3840
    pucky = 5640
    gagne = False
    Exit Sub
End If
  If Scorered.Caption = "3" Then
    On Error Resume Next
    MsgBox "Congratulations,you've won the match", , "Match Result"
    money = Form6.moneyp.Caption
    sw = Form6.swp.Caption
    sq = Form6.sqp.Caption
    jc = Form6.jcp.Caption
    money = money - 250
    sw = sw + 30
    sq = sq + 5
    jc = jc - 1
    Form6.moneyp.Caption = money
    Form6.swp.Caption = sw
    Form6.sqp.Caption = sq
    Form6.jcp.Caption = jc
    Scorered.Caption = "0"
    Scoreblue.Caption = "0"
    Me.Hide
    Form6.Show
    Timer1.Interval = "5000"
    ElseIf Scoreblue.Caption = "3" Then
    MsgBox "Sorry,you've lost the match", , "Match Result"
    money = Form6.moneyp.Caption
    sw = Form6.swp.Caption
    sq = Form6.sqp.Caption
    jc = Form6.jcp.Caption
    money = money - 250
    sw = sw - 10
    sq = sq - 10
    jc = jc + 1
    Form6.moneyp.Caption = money
    Form6.swp.Caption = sw
    Form6.sqp.Caption = sq
    Form6.jcp.Caption = jc
    Scorered.Caption = "0"
    Scoreblue.Caption = "0"
    Me.Hide
    Form6.Show
    Timer1.Interval = "5000"
    End If
If puckx < 0 Then
    Beep
    vpucky = 5
    vpuckx = 20
    puckx = -puckx
End If
If pucky < 0 Then
    If puckx < Line3.X2 And puckx > Line3.X1 Then
        gagne = True
        Exit Sub
    End If
    Beep
    vpucky = 100
    vpuckx = 0
    puckx = 3960
    pucky = 960
    paddle2.Left = 3960
End If
If puckx > 8295 Then
    Beep
    vpucky = 5
    vpuckx = -20
    puckx = 2 * 8295 - puckx
End If
If pucky > 11415 Then
    If puckx < Line3.X2 And puckx > Line3.X1 Then
        gagne = True
        Exit Sub
    End If
    Beep
    vpucky = -70
    vpuckx = 5
    puckx = 3960
    pucky = 10200
    paddle2.Left = 3960
End If
puckx = puckx + vpuckx
pucky = pucky + vpucky
puck.Left = puckx
puck.Top = pucky
padx1 = padx2
pady1 = pady2
pad2x1 = pad2x2
pad2y1 = pad2y2
padx2 = paddle1.Left
pady2 = paddle1.Top
If puckx > pad2x2 Then
    paddle2.Left = paddle2.Left + min(vpuckx, cpu.Value)
    Else
    paddle2.Left = paddle2.Left - min(Abs(vpuckx), cpu.Value)
End If
pad2x2 = paddle2.Left
If pucky < Line1.X1 And vpucky < 20 Then
    If pad2y2 - pucky > -240 Then
        pad2y2 = paddle2.Top
        Else
        paddle2.Top = paddle2.Top + 100
        pad2y2 = paddle2.Top
    End If
    Else
    If pucky < 500 And pucky > pad2y2 Then
        paddle2.Top = paddle2.Top + 100
        pad2y2 = paddle2.Top
        Else
        If paddle2.Top > 0 Then
            pad2y2 = paddle2.Top
        End If
    End If
End If

If Not (touche) And ((puckx - padx2) ^ 2 + (pucky - pady2) ^ 2) ^ (1 / 2) < 240 Then
    a = 240 / ((puckx - padx2) ^ 2 + (pucky - pady2) ^ 2) ^ (1 / 2)
    puckx = padx2 + a * (puckx - padx2)
    pucky = pady2 + a * (pucky - pady2)
    Beep
    nvitesse vpuckx, vpucky, puckx - padx2 + 0.05, pady2 - pucky
    vpuckx = (padx2 - padx1) * Abs(puckx - padx2) / 240
    vpucky = (pady2 - pady1) * Abs(pucky - pady2) / 240 - sturdinesspp
    End If
If Not (touche1) And ((puckx - pad2x2) ^ 2 + (pucky - pad2y2) ^ 2) ^ (1 / 2) < 240 Then
    a = 240 / ((puckx - padx2) ^ 2 + (pucky - pady2) ^ 2) ^ (1 / 2)
    puckx = pad2x2 + a * (puckx - pad2x2)
    pucky = pad2y2 + a * (pucky - pad2y2)
    Beep
    nvitesse vpuckx, vpucky, puckx - pad2x2 + 0.05, pad2y2 - pucky
    vpuckx = (pad2x2 - pad2x1) * Abs(puckx - pad2x2) / 240
    'CPU att or def
    If paddle2.Top < 1440 Then
    pucky = pucky + 900
    vpucky = 10
    'tip
    addtip ("Computer stop the ball...")
    Else
    pucky = paddle2.Top + 400
    vpucky = 30
        If paddle2.Top > 5760 And paddle2.Top < 6500 Then
        'tip
        addtip ("Computer get the ball...")
        ElseIf paddle2 > 6500 Then
        'tip
        addtip ("Time to shot!...")
        End If
    End If
    'cpu shooting
    If paddle2.Top > 7940 And paddle2.Left < 3000 Then
    vpuckx = 200
    vpucky = 200
    'tip
    addtip ("Shot!Great shot with right foot!")
    End If
    If paddle2.Top > 7640 And paddle2.Left > 3000 And paddle2.Left < 5000 Then
    vpuckx = 0
    vpucky = 200
    'tip
    addtip ("shot!")
    End If
    If paddle2.Top > 7940 And paddle2.Left > 5000 Then
    vpuckx = -200
    vpucky = 200
    'tip
    addtip ("Shot!How fast the ball runs!It's a beautiful shot with left foot!")
    End If
End If
vpucky = vpucky * 0.99
vpuckx = vpuckx * 0.99
If vpucky > 100 Or vpucky < -100 Then
vpuckx = vpuckx - shotingpp / 100
End If
If pucky < 2400 Then
puck.BackColor = &HFF&
ElseIf pucky > 2400 And pucky < 7500 Then
puck.BackColor = &HFF00&
Else
puck.BackColor = &HC0C0C0
End If
If puck.Top > 5640 And paddle2.Top < 9520 Then
paddle2.Top = paddle2.Top + 20
End If
If puck.Top < paddle2.Top And paddle2.Top > 1200 Then
paddle2.Top = paddle2.Top - 30
End If
'goalkeeper
goalkeeper_move
goalkeeper1_touch
goalkeeper2_touch
If paddle2.Top - pucky = 3000 Then
'tip
addtip ("Dangerous!")
End If
'others

End Sub
Sub nvitesse(vx As Single, vy As Single, dx As Single, dy As Single)
Dim angle As Single
Dim vx1, vy1 As Single
angle = Atn(dy / dx)
vx1 = vy * Cos(angle) + vx * Sin(angle)
vy1 = vy * Sin(angle) - vx * Cos(angle)
vx = vx1 * Sin(angle) + vy1 * Cos(angle)
vy = vx1 * Cos(angle) - vy1 * Sin(angle)
End Sub
'the code below is collected in the "system" module.
Private Sub yz()
On Error Resume Next
If shotingpp >= 50 Then
Command2.Enabled = True
End If
If shotingpp >= 100 Then
Command1.Enabled = True
End If
If Bcpp >= 10 Then
Command4.Enabled = True
Command16.Enabled = True
End If
If Bcpp >= 20 Then
Command13.Enabled = True
End If
If Bcpp >= 30 Then
Command19.Enabled = True
End If
If Bcpp >= 40 Then
Command12.Enabled = True
End If
If Bcpp >= 50 Then
Command14.Enabled = True
End If
If Bcpp >= 60 Then
Command15.Enabled = True
End If
If Bcpp >= 70 Then
Command17.Enabled = True
End If
If Bcpp >= 80 Then
Command18.Enabled = True
End If
If Bcpp >= 90 Then
Command20.Enabled = True
End If
If passingpp >= 30 Then
Command25.Enabled = True
End If
If passingpp >= 40 Then
Command28.Enabled = True
End If
If passingpp >= 50 Then
Command26.Enabled = True
End If
If passingpp >= 60 Then
Command29.Enabled = True
End If
If headerpp >= 10 Then
Command8.Enabled = True
End If
If headerpp >= 20 Then
Command6.Enabled = True
End If
If headerpp >= 30 Then
Command5.Enabled = True
End If
If headerpp >= 40 Then
Command7.Enabled = True
End If
If headerpp >= 50 Then
Command11.Enabled = True
End If
If headerpp >= 100 Then
Command9.Enabled = True
End If
If headerpp >= 150 Then
Command10.Enabled = True
End If
If additionpp > 0 Then
    addheader.Enabled = True
    addfitness.Enabled = True
    addsturdiness.Enabled = True
    addpassing.Enabled = True
    addshoting.Enabled = True
    addballcontrol.Enabled = True
    Else
    addheader.Enabled = False
addfitness.Enabled = False
addsturdiness.Enabled = False
addpassing.Enabled = False
addshoting.Enabled = False
addballcontrol.Enabled = False
End If
End Sub
'the code below is collected in the "refresh" module.
Private Sub sx()
headerp.Caption = headerpp
fitnessp.Caption = fitnesspp
sturdinessp.Caption = sturdinesspp
passingp.Caption = passingpp
shotingp.Caption = shotingpp
additionp.Caption = additionpp
Bcp.Caption = Bcpp
r.Caption = rp
m.Caption = mp
End Sub
'the code below is collected in the "saveandload" module.
Private Sub save_file()
save_ini = App.Path + "\save.INI"
    xx = upd_ini_data(save_ini, save_num, "name", namep.Caption)
    xx = upd_ini_data(save_ini, save_num, "age", agep.Caption)
    xx = upd_ini_data(save_ini, save_num, "position", positionp.Caption)
    xx = upd_ini_data(save_ini, save_num, "headerpp", headerpp)
    xx = upd_ini_data(save_ini, save_num, "fitnesspp", fitnesspp)
    xx = upd_ini_data(save_ini, save_num, "passingpp", passingpp)
    xx = upd_ini_data(save_ini, save_num, "shotingpp", shotingpp)
    xx = upd_ini_data(save_ini, save_num, "additionpp", additionpp)
    xx = upd_ini_data(save_ini, save_num, "Bcpp", Bcpp)
    xx = upd_ini_data(save_ini, save_num, "rp", rp)
    xx = upd_ini_data(save_ini, save_num, "mp", mp)
    savefile_refresh
End Sub
Private Sub load_file()
save_ini = App.Path + "\save.INI"
    headerpp = Trim(rtv_ini_data(save_ini, load_num, "headerpp"))
    additionpp = Trim(rtv_ini_data(save_ini, load_num, "additionpp"))
    rp = Trim(rtv_ini_data(save_ini, load_num, "rp"))
    mp = Trim(rtv_ini_data(save_ini, load_num, "mp"))
    sturdinesspp = Trim(rtv_ini_data(save_ini, load_num, "sturdinesspp"))
    fitnesspp = Trim(rtv_ini_data(save_ini, load_num, "fitnesspp"))
    shotingpp = Trim(rtv_ini_data(save_ini, load_num, "shotingpp"))
    passingpp = Trim(rtv_ini_data(save_ini, load_num, "passingpp"))
    Bcpp = Trim(rtv_ini_data(save_ini, load_num, "Bcpp"))
    namep.Caption = Trim(rtv_ini_data(save_ini, load_num, "name"))
    agep.Caption = Trim(rtv_ini_data(save_ini, load_num, "age"))
    positionp.Caption = Trim(rtv_ini_data(save_ini, load_num, "position"))
    Form2.Label7.Caption = Trim(rtv_ini_data(save_ini, load_num, "name"))
sx
End Sub

Private Sub savefile_refresh()
save_ini = App.Path + "\save.INI"
  f1n.Caption = Trim(rtv_ini_data(save_ini, 1, "name"))
  f2n.Caption = Trim(rtv_ini_data(save_ini, 2, "name"))
  f3n.Caption = Trim(rtv_ini_data(save_ini, 3, "name"))
  f1r.Caption = Trim(rtv_ini_data(save_ini, 1, "rp"))
  f2r.Caption = Trim(rtv_ini_data(save_ini, 2, "rp"))
  f3r.Caption = Trim(rtv_ini_data(save_ini, 3, "rp"))
  f1m.Caption = Trim(rtv_ini_data(save_ini, 1, "mp"))
  f2m.Caption = Trim(rtv_ini_data(save_ini, 2, "mp"))
  f3m.Caption = Trim(rtv_ini_data(save_ini, 3, "mp"))
End Sub
'the code below is collected in the "goalkeeper" module.
Private Sub goalkeeper_move()
If puckx > goalkeeper1.Left And goalkeeper1.Left < 5880 Then
goalkeeper1.Left = goalkeeper1.Left + 30
goalkee

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -