Private Declare Function GetShortPathName Lib "kernel32" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpszCommand As String, ByVal lpszReturnString As String, ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
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
Declare Function GetTickCount Lib "kernel32" () As Long
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Public Const SRCAND = &H8800C6 ' (DWORD) dest = source AND dest
Public Const SRCINVERT = &H660046 ' (DWORD) dest = source XOR dest
Public Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest
Public Const sRed = 0
Public Const sBlue = 1
Public Const sGreen = 2
Public Const sMine = 3
Public Const pShield = 0
Type Player
'movement and placement info
x As Long
y As Long
XS As Long
YS As Long
Boost As Long
Rotate As Long
'identifying properties
Score As Long
Band As Long
Nick As String
Health As Long
MAXHP As Long
id As Long
Type As Long
Act As Long
Reload As Long
Armor As Long
ReSmoke As Long
'powerups
Shield As Long
DeathBall As Long
Mines As Long
Superman As Long
'AI Info
Target As Long 'which player to target
AI As Boolean 'determines if its a comp player
BoostLeft As Long
End Type
Type Shot
'movement and placement info
x As Long
y As Long
XS As Long
YS As Long
Rotate As Long
'identifying info
Act As Boolean
id As Long
Type As Long
Damage As Long 'how much damage the bullet does
Count As Long 'how long it lasts
End Type
Type PowerUp
'placement and animation info
x As Long
y As Long
'identifying info
Count As Long 'how long it has left (powerups dont stay forever ya know)
Act As Long
Type As Long 'type of powerup
End Type
Type Explosion
'movement and placement info
x As Long
y As Long
XS As Long
YS As Long
'anim
Frame As Long 'current animation frame
Frames As Long 'how many frames are in animation
'identifying info
Act As Long
Type As Long
End Type
Type text
Major As String 'title
Minor As String 'subtitle
End Type
Type GameInfo ' not used
VictoryType As Long 'what kind of victory
ReqScore As Long 'the required score of a player to win (if any)
Time As Long 'time left in the game (if a timed game)
End Type
Type Asteroid
x As Long
y As Long
Rotate As Long
XS As Long
YS As Long
Act As Long
End Type
Public P(1 To 4) As Player
Public S() As Shot
Public PUP(20) As PowerUp
Public Explo(1 To 30) As Explosion
Public A(10) As Asteroid
Public Message As text
Public Running As Boolean
Public Bands As Boolean
Public Speed As Long
'masking hdcs for collison detection
Public PMask(5) As Long, SMask(10) As Long, PUPMask(10) As Long, AMask As Long
Public Playing As Boolean
Public TeamName(1 To 2) As String
Public i As Long
Function MakePowerup(T As Long)
Dim i As Long
For i = 0 To 20
If PUP(i).Act = False Then
PUP(i).Type = T
PUP(i).x = Int(Rnd * frmGame.board.ScaleWidth)
PUP(i).y = Int(Rnd * frmGame.board.ScaleHeight)
PUP(i).Count = 120
PUP(i).Act = True
Debug.Print "Powerup MadE"
Exit For
End If
Next i
End Function
Function MakePlayer(x, y, Name, Band, PType) As Boolean
Dim c As Long 'counter variable
For c = 1 To 4
If P(c).Act = False Then
'set the coors
P(c).x = x
P(c).y = y
'reset the props
P(c).XS = 0
P(c).YS = 0
P(c).Rotate = 0
'set other props
P(c).id = c
P(c).Type = PType
P(c).Nick = Name
'activate player
P(c).Act = True
P(c).Health = 50
Select Case PType
Case sRed
P(c).Armor = 2
Case sBlue
P(c).Armor = 0
Case sGreen
P(c).Armor = 4
End Select
P(c).Shield = 30
Exit For
End If
Next c
End Function
Function TurnLeft(P As Player)
P.Rotate = P.Rotate - 1: If P.Rotate < 0 Then P.Rotate = 7
End Function
Function TurnRight(P As Player)
P.Rotate = P.Rotate + 1: If P.Rotate > 7 Then P.Rotate = 0
End Function
Function MoveForward(Player As Player)
Dim Acc As Long
Player.Boost = 1
Select Case Player.Type
Case sBlue
Acc = 9
Case sRed
Acc = 7
Case sGreen
Acc = 5
End Select
If Player.Rotate = 0 Then: SetSpeed 0, -Acc, Player
If Player.Rotate = 1 Then: SetSpeed Acc, -Acc, Player
If Player.Rotate = 2 Then: SetSpeed Acc, 0, Player
If Player.Rotate = 3 Then: SetSpeed Acc, Acc, Player
If Player.Rotate = 4 Then: SetSpeed 0, Acc, Player
If Player.Rotate = 5 Then: SetSpeed -Acc, Acc, Player
If Player.Rotate = 6 Then: SetSpeed -Acc, 0, Player
If Player.Rotate = 7 Then: SetSpeed -Acc, -Acc, Player
Select Case Player.Type
Case sBlue
If Player.XS < -20 Then Player.XS = -20
If Player.XS > 20 Then Player.XS = 20
If Player.YS < -20 Then Player.YS = -20
If Player.YS > 20 Then Player.YS = 20
Case sRed
If Player.XS < -15 Then Player.XS = -15
If Player.XS > 15 Then Player.XS = 15
If Player.YS < -15 Then Player.YS = -15
If Player.YS > 15 Then Player.YS = 15
Case sGreen
If Player.XS < -10 Then Player.XS = -10
If Player.XS > 10 Then Player.XS = 10
If Player.YS < -10 Then Player.YS = -10
If Player.YS > 10 Then Player.YS = 10
End Select
End Function
Function Fire(Player As Player, T As Long)
If Player.Reload > 0 Then Exit Function
Dim c As Long
For c = 0 To UBound(S())
If S(c).Act = False Then
S(c).x = Player.x + 37 - 15
S(c).y = Player.y + 37 - 15
S(c).Count = 20
S(c).id = Player.id
Player.Reload = 3
If Player.Rotate = 0 Then: S(c).XS = 0
If Player.Rotate = 1 Then: S(c).XS = 14
If Player.Rotate = 2 Then: S(c).XS = 14
If Player.Rotate = 3 Then: S(c).XS = 14
If Player.Rotate = 4 Then: S(c).XS = 0
If Player.Rotate = 5 Then: S(c).XS = -14
If Player.Rotate = 6 Then: S(c).XS = -14
If Player.Rotate = 7 Then: S(c).XS = -14
If Player.Rotate = 0 Then: S(c).YS = -14
If Player.Rotate = 1 Then: S(c).YS = -14
If Player.Rotate = 2 Then: S(c).YS = 0
If Player.Rotate = 3 Then: S(c).YS = 14
If Player.Rotate = 4 Then: S(c).YS = 14
If Player.Rotate = 5 Then: S(c).YS = 14
If Player.Rotate = 6 Then: S(c).YS = 0
If Player.Rotate = 7 Then: S(c).YS = -14
S(c).Type = T
S(c).Act = True
Select Case T
Case sBlue
S(c).Damage = 1
S(c).Rotate = 0
Case sRed
S(c).Damage = 2
S(c).Rotate = Player.Rotate
Case sGreen
S(c).Damage = 3
S(c).Rotate = 0
Case sMine
S(c).Damage = 10
S(c).Rotate = 0
S(c).XS = 0
S(c).YS = 0
S(c).Count = 500
Player.Mines = Player.Mines - 1
End Select
If Player.Superman > 0 Then
S(c).Damage = S(c).Damage * 1.5
S(c).Count = S(c).Count + 20
S(c).Type = S(c).Type + 4
End If
Exit For
End If
Next c
End Function
Function SetSpeed(XSpeed, YSpeed, Player As Player)
Player.XS = Player.XS + XSpeed
Player.YS = Player.YS + YSpeed
End Function
Function MovePlayer(Player As Player)
On Error Resume Next
Dim c As Long, Friction As Long, SmokeThing, i, AV
For c = 0 To 20
If PUP(c).Act = True Then
If CollisionDetect(Player.x, Player.y, 75, 75, Player.Rotate * 75, 0, PMask(Player.Type), PUP(c).x, PUP(c).y, 30, 30, 0, 0, PUPMask(PUP(c).Type)) = True Then