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

📄 frmstart.frm

📁 VB编写的疯狂贪吃蛇小游戏,有声音的~
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H80000008&
   BorderStyle     =   0  'None
   Caption         =   "Form1"
   ClientHeight    =   2490
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   3645
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   Picture         =   "FrmStart.frx":0000
   ScaleHeight     =   2490
   ScaleWidth      =   3645
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.Timer Timer2 
      Interval        =   1
      Left            =   3000
      Top             =   120
   End
   Begin VB.Timer Timer1 
      Interval        =   1
      Left            =   3000
      Top             =   120
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000006&
      BorderStyle     =   0  'None
      ForeColor       =   &H80000008&
      Height          =   2490
      Left            =   0
      ScaleHeight     =   2490
      ScaleWidth      =   3645
      TabIndex        =   0
      Top             =   0
      Visible         =   0   'False
      Width           =   3645
      Begin VB.Label Label1 
         Appearance      =   0  'Flat
         BackColor       =   &H80000005&
         BackStyle       =   0  'Transparent
         ForeColor       =   &H0000FFFF&
         Height          =   2535
         Left            =   0
         TabIndex        =   1
         Top             =   0
         Width           =   3615
      End
   End
   Begin VB.Shape Shape2 
      BorderColor     =   &H0000FFFF&
      Height          =   2460
      Left            =   0
      Shape           =   4  'Rounded Rectangle
      Top             =   0
      Width           =   3645
   End
   Begin VB.Label TXT 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "疯狂贪吃蛇MadSnake"
      BeginProperty Font 
         Name            =   "Geometr885 BT"
         Size            =   18
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H80000008&
      Height          =   885
      Left            =   360
      TabIndex        =   5
      Top             =   0
      Width           =   2805
   End
   Begin VB.Image S 
      Appearance      =   0  'Flat
      Height          =   240
      Left            =   0
      Picture         =   "FrmStart.frx":0542
      Stretch         =   -1  'True
      Top             =   0
      Width           =   240
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H0000FFFF&
      Height          =   255
      Left            =   1320
      Top             =   1920
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.Label op3 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "退出游戏"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   240
      Left            =   1335
      TabIndex        =   4
      Top             =   1920
      Width           =   1065
   End
   Begin VB.Label OP2 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "关于游戏"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   240
      Left            =   1335
      TabIndex        =   3
      Top             =   1440
      Width           =   1065
   End
   Begin VB.Label OP1 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "开始游戏"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00FFFFFF&
      Height          =   240
      Left            =   1335
      TabIndex        =   2
      Top             =   960
      Width           =   1065
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
  Dim COL As Integer, CTCO As Integer
  Dim CTS As Integer
Private Sub Form_Activate()
  SUCCESS = sndPlaySound(App.Path + "\sound\start.WAV", &H1)
End Sub

Private Sub Form_Load()
Load FrmSna
CTS = 1
FrmSna.Timer1.Enabled = False
Label1.Top = Picture1.Top + Picture1.Height
  CTCO = 2
  COL = 0
Me.Picture = LoadPicture("")
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Visible = False
End Sub

Private Sub Label1_Click()
Timer1.Enabled = False
Picture1.Visible = False
End Sub

Private Sub OP1_Click()
Me.Hide
FrmSna.Timer1.Enabled = True
FrmSna.Show

End Sub

Private Sub OP1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Visible = True
Shape1.Top = 960
End Sub
Private Sub OP2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Visible = True
Shape1.Top = 1440
End Sub
Private Sub OP3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.Visible = True
Shape1.Top = 1920
End Sub

Private Sub OP2_Click()
Label1.Top = Picture1.Top + Picture1.Height
Picture1.Visible = True
Timer1.Enabled = True
Label1.Caption = Space(10) & "疯狂贪吃蛇(测试版)" & Space(16) & "疯狂贪吃蛇(测试版)是我发布的第一个小游戏!" & Chr(13) & "操作说明:方向键控制方向、Escape暂停" & Chr(13) & "小沅"

End Sub

Private Sub Picture1_Click()
Timer1.Enabled = False
Picture1.Visible = False
End Sub

Private Sub Timer1_Timer()
Label1.Top = Label1.Top - 10
If S.Left + S.Width > Me.ScaleLeft + Me.Width Then CTS = 2
If S.Left < Me.ScaleLeft Then CTS = 1

If CTS = 1 Then S.Left = S.Left + 50
If CTS = 2 Then S.Left = S.Left - 50

End Sub

Private Sub Timer2_Timer()
 '标题的淡出淡入
  If CTCO = 1 Then COL = COL - 5
  If CTCO = 2 Then COL = COL + 5
  If COL > 240 Then CTCO = 1
  If COL < 10 Then CTCO = 2
  TXT.ForeColor = RGB(COL, COL, COL)

End Sub

⌨️ 快捷键说明

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