Требование VB 6.0, я автор:
файл frmlevel0.frm код:
Код:
VERSION 5.00
Begin VB.Form frmLevel0
BorderStyle = 0 'None
Caption = "Уровень 2"
ClientHeight = 7200
ClientLeft = 0
ClientTop = 0
ClientWidth = 9600
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
MousePointer = 99 'Custom
Picture = "frmlevel0.frx":0000
ScaleHeight = 480
ScaleMode = 3 'Pixel
ScaleWidth = 640
ShowInTaskbar = 0 'False
StartUpPosition = 2 'CenterScreen
Begin VB.PictureBox PictWindows
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 2715
Index = 2
Left = 8280
MousePointer = 99 'Custom
Picture = "frmlevel0.frx":E1042
ScaleHeight = 2715
ScaleWidth = 1005
TabIndex = 5
Top = 3600
Visible = 0 'False
Width = 1005
End
Begin VB.PictureBox PictWindows
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 2715
Index = 1
Left = 4080
MousePointer = 99 'Custom
Picture = "frmlevel0.frx":EA0C0
ScaleHeight = 2715
ScaleWidth = 1170
TabIndex = 4
Top = 3840
Visible = 0 'False
Width = 1170
End
Begin VB.Timer Timer2
Left = 2040
Top = 2040
End
Begin VB.Timer Timer1
Left = 1200
Top = 1920
End
Begin VB.PictureBox picCursor
AutoRedraw = -1 'True
AutoSize = -1 'True
Height = 540
Left = 3480
Picture = "frmlevel0.frx":F47DE
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 1
Top = 360
Visible = 0 'False
Width = 540
End
Begin VB.PictureBox PictWindows
AutoRedraw = -1 'True
AutoSize = -1 'True
BorderStyle = 0 'None
Height = 2655
Index = 0
Left = 1080
MousePointer = 99 'Custom
Picture = "frmlevel0.frx":F4930
ScaleHeight = 2655
ScaleWidth = 930
TabIndex = 0
Top = 3360
Visible = 0 'False
Width = 930
End
Begin VB.Label lbClose
BackStyle = 0 'Transparent
Caption = "X"
BeginProperty Font
Name = "MS Sans Serif"
Size = 13.5
Charset = 204
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 9360
MousePointer = 1 'Arrow
TabIndex = 3
Top = 0
Width = 375
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Очки:0"
BeginProperty Font
Name = "MS Sans Serif"
Size = 24
Charset = 204
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 4200
TabIndex = 2
Top = 0
Width = 5295
End
End
Attribute VB_Name = "frmLevel0"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
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
Const SND_ASYNC = &H1 ' play asynchronously
Const SND_SYNC = &H0 ' play synchronously (default)
Dim i As Long, n As Long, res As Long
Dim what_cols(10) As Boolean
Dim col As Long, curr As Long
Dim scores As Long, Lives As Long
Dim ObjDx As DirectX7
Dim ObjDraw As DirectDraw7
Dim max_v As Long
Private Const SRCCOPY = &HCC0020
Private Const SRCAND = &H8800C6
Private Const SRCERASE = &H440328
Private Const SRCINVERT = &H660046
Private Const SRCPAINT = &HEE0086
Private Sub Form_Load()
Dim j As Long
' Set ObjDx = New DirectX7
' Set ObjDraw = ObjDx.DirectDrawCreate("")
' ObjDraw.SetCooperativeLevel frmLevel0.hWnd, DDSCL_FULLSCREEN Or DDSCL_EXCLUSIVE
' ObjDraw.SetDisplayMode 640, 480, 16, 0, DDSDM_DEFAULT
For j = 0 To Me.PictWindows.Count - 1
BitBlt Me.PictWindows(j), Me.PictWindows(j).Left, Me.PictWindows(j).Top, Me.PictWindows(j).Width, Me.PictWindows(j).Height, Me.hDC, 0, 0, SRCCOPY
Next j
max_v = 3
Lives = 5
Me.MouseIcon = Me.picCursor.Picture
For j = 0 To Me.PictWindows.Count - 1
Me.PictWindows(j).Visible = True
Me.PictWindows(j).MouseIcon = Me.picCursor.Picture
Me.PictWindows(j).Picture = Me.picCursor.Picture
what_cols(j) = False
Next j
col = 1
Timer1.Interval = 1000
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
sndPlaySound App.Path & "\gunshot.wav", SND_ASYNC
scores = scores - 10
End Sub
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
Timer2.Enabled = False
End Sub
Private Sub lbClose_Click()
Unload Me
End Sub
Private Sub PictWindows_MouseDown(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim j As Long
sndPlaySound App.Path & "\gunshot.wav", SND_ASYNC
If what_cols(Index) = True Then
scores = scores + 10
Timer2.Enabled = False
Else
scores = scores - 10
End If
For j = 0 To Me.PictWindows.Count - 1
Me.PictWindows(j).Visible = True
Me.PictWindows(j).MouseIcon = Me.picCursor.Picture
Me.PictWindows(j).Picture = Me.Picture1.Picture
Next j
End Sub
Private Sub PictWindows_MouseMove(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Timer2.Enabled = True
Timer2.Interval = Timer1.Interval + 100
curr = Index
End Sub
Private Sub PictWindows_MouseUp(Index As Integer, Button As Integer, Shift As Integer, x As Single, y As Single)
Dim j As Long
For j = 0 To Me.PictWindows.Count - 1
what_cols(j) = False
Next j
End Sub
Private Sub Timer1_Timer()
Dim j As Long
For j = 0 To Me.PictWindows.Count - 1
Me.PictWindows(j).Visible = True
Me.PictWindows(j).MouseIcon = Me.picCursor.Picture
Me.PictWindows(j).Picture = Me.picCursor.Picture
Next j
For i = 1 To col
res = Int(Rnd * max_v)
Me.PictWindows(res) = Me.picSoldat.Picture
what_cols(res) = True
Next i
For j = 0 To 5000
Sin 0.5
Timer1.Enabled = False
Next j
Timer1.Enabled = True
Me.Label1.Caption = "Очки:" & scores & " Жизней:" & Lives
End Sub
Private Sub Timer2_Timer()
Dim j As Long
Me.PictWindows(res).Picture = Me.picSoldat.Picture
Timer2.Enabled = False
sndPlaySound App.Path & "\explode.wav", SND_ASYNC
Me.PictWindows(res) = Me.picSoldatFire.Picture
Lives = Lives - 1
End Sub