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

📄 form1.frm

📁 一款飞机射击游戏的源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "Form1"
   ClientHeight    =   5415
   ClientLeft      =   2400
   ClientTop       =   1035
   ClientWidth     =   8250
   LinkTopic       =   "Form1"
   ScaleHeight     =   361
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   550
   Begin VB.PictureBox Picture2 
      AutoRedraw      =   -1  'True
      BackColor       =   &H00FF00FF&
      BorderStyle     =   0  'None
      Height          =   1455
      Left            =   840
      ScaleHeight     =   97
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   449
      TabIndex        =   1
      Top             =   1320
      Width           =   6735
   End
   Begin VB.PictureBox Picture1 
      AutoSize        =   -1  'True
      BorderStyle     =   0  'None
      Height          =   480
      Left            =   480
      Picture         =   "Form1.frx":0000
      ScaleHeight     =   32
      ScaleMode       =   3  'Pixel
      ScaleWidth      =   203
      TabIndex        =   0
      Top             =   480
      Width           =   3045
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Const VK_DOWN = &H28
Private Const VK_UP = &H26
Private Const VK_LEFT = &H25
Private Const VK_RIGHT = &H27

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
Private Declare Function timeGetTime Lib "winmm.dll" () As Long

Dim CurMyFps As Single
Dim CurMyXp1 As Single
Dim CurMyYp1 As Single
Dim isrun As Boolean
Private Sub Form_Activate()
Dim Kt As Long
CurMyFps = 4
isrun = True
Picture2.Move Picture2.Left, Picture2.Top, Picture2.Width, 200
CurMyXp1 = 200
CurMyYp1 = 100
Do While isrun
DoEvents
Kt = timeGetTime
    Picture2.Cls
    BitBlt Picture2.hDC, CurMyXp1, CurMyYp1, 29, Picture1.Height, Picture1.hDC, (Int(CurMyFps) - 1) * 29, 0, vbSrcCopy
    If GetAsyncKeyState(VK_LEFT) Then
        CurMyFps = CurMyFps - 0.5
        CurMyXp1 = CurMyXp1 - 4
        If CurMyFps <= 1.5 Then CurMyFps = 1.5
    ElseIf GetAsyncKeyState(VK_RIGHT) Then
        CurMyFps = CurMyFps + 0.5
        CurMyXp1 = CurMyXp1 + 4
        If CurMyFps >= 7.5 Then CurMyFps = 7.5
    Else
        If CurMyFps >= 4.5 Then
            CurMyFps = CurMyFps - 0.5
        ElseIf CurMyFps < 4 Then
            CurMyFps = CurMyFps + 0.5
        End If
    End If
    
    If GetAsyncKeyState(VK_UP) Then
        CurMyYp1 = CurMyYp1 - 4
    ElseIf GetAsyncKeyState(VK_DOWN) Then
        CurMyYp1 = CurMyYp1 + 4
    End If
        
    
DoEvents
While timeGetTime - Kt < 35
DoEvents
Wend
Loop
End Sub

Private Sub Form_Unload(Cancel As Integer)
isrun = False
End Sub

⌨️ 快捷键说明

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