📄 shooterdemo.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H00000000&
Caption = "the demo of a simple shoot'em up game"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
DrawStyle = 1 'Dash
DrawWidth = 2
FillColor = &H00FF0000&
FillStyle = 0 'Solid
ForeColor = &H00FFFFFF&
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
WindowState = 2 'Maximized
Begin VB.PictureBox picStatus
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000006&
ForeColor = &H80000008&
Height = 1125
Left = 225
ScaleHeight = 1095
ScaleWidth = 9465
TabIndex = 2
Top = 90
Width = 9495
Begin VB.TextBox txtCommandKeywords
Alignment = 2 'Center
Appearance = 0 'Flat
BackColor = &H0000FFFF&
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 161
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 975
Left = 0
Locked = -1 'True
MultiLine = -1 'True
TabIndex = 6
TabStop = 0 'False
Top = 240
Width = 1575
End
Begin VB.CommandButton cmdExit
Caption = "EXIT"
Height = 255
Left = 8160
TabIndex = 4
Top = 840
Width = 735
End
Begin VB.Label lblCommandKeywords
Alignment = 2 'Center
BackStyle = 0 'Transparent
Caption = "Command Keywords"
BeginProperty Font
Name = "MS Sans Serif"
Size = 8.25
Charset = 161
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H8000000E&
Height = 495
Left = 0
TabIndex = 5
Top = 0
Width = 1695
End
Begin VB.Label lblText
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H80000006&
Caption = $"ShooterDemo.frx":0000
ForeColor = &H0000FFFF&
Height = 972
Left = 1800
TabIndex = 3
Top = 0
Width = 7392
WordWrap = -1 'True
End
End
Begin VB.PictureBox sprINVADER5
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000006&
ForeColor = &H80000008&
Height = 615
Left = 7200
Picture = "ShooterDemo.frx":01D7
ScaleHeight = 588.774
ScaleMode = 0 'User
ScaleWidth = 1113.763
TabIndex = 0
Top = 480
Visible = 0 'False
Width = 1140
End
Begin VB.Timer Timer1
Interval = 1
Left = 1680
Top = 1200
End
Begin VB.Label lblBlank
Appearance = 0 'Flat
BackColor = &H80000006&
Caption = " "
ForeColor = &H80000008&
Height = 735
Left = 3240
TabIndex = 1
Top = 1320
Width = 1095
End
Begin VB.Image imgKABOOM
Height = 705
Index = 3
Left = 1320
Picture = "ShooterDemo.frx":115D
Top = 120
Visible = 0 'False
Width = 735
End
Begin VB.Image imgKABOOM
Height = 780
Index = 6
Left = 3120
Picture = "ShooterDemo.frx":1F2B
Top = 120
Visible = 0 'False
Width = 795
End
Begin VB.Image imgKABOOM
Height = 735
Index = 5
Left = 2520
Picture = "ShooterDemo.frx":2ECD
Top = 120
Visible = 0 'False
Width = 795
End
Begin VB.Image imgKABOOM
Height = 735
Index = 4
Left = 1920
Picture = "ShooterDemo.frx":4DAF
Top = 120
Visible = 0 'False
Width = 795
End
Begin VB.Image imgKABOOM
Height = 720
Index = 2
Left = 720
Picture = "ShooterDemo.frx":5CA9
Top = 120
Visible = 0 'False
Width = 705
End
Begin VB.Image imgKABOOM
Height = 705
Index = 1
Left = 0
Picture = "ShooterDemo.frx":69EB
Top = 0
Visible = 0 'False
Width = 705
End
Begin VB.Image sprSHIP
Appearance = 0 'Flat
Height = 645
Left = 3600
Picture = "ShooterDemo.frx":76FD
Top = 5760
Visible = 0 'False
Width = 2085
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Declare all the variables to optimize
'execution and make them accessible to
'every sub procedure in the program.
'
'The coordinates,velocity, and size of the
'stars that are moving on the background
Dim X(30), Y(30), pace(30), size(30) As Integer
'The coordinates of the spaceship sprite
'(the good guy...)
Dim x2, y2, xn As Integer
'Variable that defines the movement of the
'good guy (takes the values "Left" and
'"Right")
Dim movement As String
'Variable that is used to create the
'"laser blaster" effect when the good guy
'shoots.At first,it takes the value 1 and
'a line is drawn on the form ,either blue
'or white.Then it takes the value 2 and a
'new line line is drawn (the other color)
'Then a black line is drawn in order to
'erase the shot (the background of the form
'is black,too)
Dim shot As Integer
'The X coordinate of the line that represents
'the good guy's gunfire
Dim xshot As Integer
'Variables that define the movement of the
'5 rows of aliens.They take the values "Left"
'and "Right"
Dim Mi1, Mi2, Mi3, Mi4, Mi5 As String
'X and Y Coordinates of the top alien
Dim xi1, yi1 As Integer
'X and Y coordinates of the aliens in
'rows 2-5
Dim xi2(2), xi3(3), xi4(4), xi5(5) As Integer
Dim yi2(2), yi3(3), yi4(4), yi5(5) As Integer
'Variable that is used to define which alien
'is beign shot each time so that the frames
'of the explosion are painted at the right
'spot of the form ( is assigned a X
'coordinate of an alien,ie xinv=xi2(2) )
Dim xinv, yinv As Variant
'Integer that defines where the laser beem
'will stop (it's a Y coordinate in fact)
Dim upper As Integer
'Array that defines which aliens are dead.
'Counting starts from the top row.ie if
'the good guy kills the second alien from
'the right in the 5th row,the array element
'kill(14) will be assigned the value True
Dim kill(15) As Boolean
'Integer that counts how many aliens are
'dead.If it gets the value 15 (meaning the
'good huy cleared the level) the game starts
'over again.
Dim dead As Integer
'Boolean type variable that's set to True
'while an explosion is painted on the form
'It is used to halt some other procedures
'in order to prevent flickering and bugs
Dim boom As Boolean
'Defines which frame of the explosion must
'be painted the next time the Timer event
'occurs (that's every 0,001 sec).
Dim explosion As Integer
'Color contants that are used with the Shot
'variable to create the "laser blaster"
'effect when the good guy shoots
Dim COL1, COL2 As ColorConstants
'Guess what this one means ...
Dim YouDied As Boolean
'Variable holding the score.In fact it is
'the number of aliens that are dead(variable
'Dead) multiplied by 1000
Dim score
'Integer that is assigned a random value from
'0 to 10 and defines the delay before the
'next movement command is executed
Dim Wait As Integer
'Variables used in playing the sound module
Dim RetVal As Long
Dim ModFileName$
Dim XOX As Integer
'The EXIT button
Private Sub cmdExit_Click()
Close
XOX = ModPlug_Stop(RetVal)
XOX = ModPlug_Destroy(RetVal)
For Each F In Forms
Unload F
Next
End Sub
'The procedure that runs after Form_Load.It
'It is used to give starting values to all
'the variables that must be reset every
'time a new level begins
Private Sub Form_Activate()
'Set starting values for the movement of each row
'of aliens.All the aliens in one row move towards
'the same direction and change direction when the
'far right or far left alien hits the edge of the
'form.This is why killing the aliens on the far
'right and far left slows down their vertical movement
'start the background midi.
Mi1 = "LEFT"
Mi2 = "RIGHT"
Mi3 = "LEFT"
Mi4 = "RIGHT"
Mi5 = "LEFT"
Timer1.Enabled = True
Cls
dead = 0
Form1.KeyPreview = True
Randomize
picStatus.Move ScaleWidth / 2 - picStatus.Width / 2, 0
'This code sets the coordinates,velocity
'and size of the 30 small circles that
'contantly move on the background.
For i = 1 To 30
X(i) = Int(Form1.Width * Rnd)
Y(i) = Int(Form1.Height * Rnd)
pace(i) = Int(500 - (Int(Rnd * 499)))
size(i) = 14 - (13 * Rnd)
Next
'Set starting values for the coordinates
'of the spaceship sprite
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -