Welcome back. I know your probably dying to see an operational VB game.
Well here's your chance. Domination is a full-scale text strategy game, and Ultra-Sub is even better.
NOTE: Text strategy is NOT the only option for VB. You can see that in CodeRed.
Here is a full-size screen shot of the user interface (You'll most likely have to scroll to fit in):

Just make the game screen in your copy of VB look similar.
Here's the code (I'll leave it to you to figure it out):
'Domination (C) 2004 JMRS Development
'***********************************************
Option Explicit 'Make it so the variables must be declared
' Now we declare the variables
Dim cash As Integer
Dim tanksown As Boolean
Dim infantryown As Boolean
Dim fightersown As Boolean
Dim bombersown As Boolean
Dim submarinesown As Boolean
Dim battleshipsown As Boolean
Dim destroyersown As Boolean
Dim cruisersown As Boolean
Dim artilleryown As Boolean
Dim britainallied As Boolean
Dim franceallied As Boolean
Dim germanyallied As Boolean
Dim russiaallied As Boolean
Dim canadaallied As Boolean
Dim australiaallied As Boolean
Dim brazilallied As Boolean
Dim japanallied As Boolean
Dim chinaallied As Boolean
Dim britainpower As Integer
Dim francepower As Integer
Dim germanypower As Integer
Dim russiapower As Integer
Dim canadapower As Integer
Dim australiapower As Integer
Dim brazilpower As Integer
Dim japanpower As Integer
Dim chinapower As Integer
Dim numallys As Integer
Dim youattack As Boolean
Dim whoattacking As String
Dim whatattacking As String
Dim maxallys As Integer
Dim youpower As Integer
Dim youdefending As Boolean
Sub fightersfight()
If youattack = True Then
Randomize
If Rnd < 0.8 Then
Randomize
fightersattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 3
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 3
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 3
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 3
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 3
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 3
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 3
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 3
chinaoutcheck
Else
GoTo fightersattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your fighters were destroyed!", vbCritical
fightersown = False
fightersdeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "The attack was uneventful.", vbInformation
Case "infantry"
MsgBox "The infantry got their SAMS and shot you down!", vbCritical
fightersown = False
fightersdeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "fighters"
MsgBox "You managed, after an intense fight to shoot down their fighters!", vbExclamation
Case "bombers"
MsgBox "You shot down the bombers!", vbExclamation
Case "submarines"
MsgBox "You managed to scare off their subs.", vbInformation
Case "destroyers"
MsgBox "The destroyers shot down your fighters.", vbCritical
fightersown = False
fightersdeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "battleships"
MsgBox "Your attack was uneventful.", vbInformation
Case "cruisers"
MsgBox "Your attack was uneventful.", vbInformation
Case "artillery"
MsgBox "Your attack was uneventful.", vbInformation
End Select
End If
End Sub
Sub responsedisable()
If youdefending = False And youattack = False Then
If whatattacking = "tanks" Then
MsgBox "Their tanks are attacking!", vbCritical
youpower = youpower - 3
losecheck
ElseIf whatattacking = "infantry" Then
MsgBox "Their infantry are attacking!", vbCritical
youpower = youpower - 1
losecheck
ElseIf whatattacking = "fighters" Then
MsgBox "Their fighters are attacking!", vbCritical
youpower = youpower - 2
losecheck
ElseIf whatattacking = "bombers" Then
MsgBox "Their bombers are attacking!", vbCritical
youpower = youpower - 3
losecheck
ElseIf whatattacking = "submarines" Then
MsgBox "Their submarines are attacking!", vbCritical
youpower = youpower - 1
losecheck
ElseIf whatattacking = "destroyers" Then
MsgBox "Their destroyers are attacking!", vbCritical
youpower = youpower - 2
losecheck
ElseIf whatattacking = "battleships" Then
MsgBox "Their battleships are attacking!", vbCritical
youpower = youpower - 5
losecheck
ElseIf whatattacking = "cruisers" Then
MsgBox "Their cruisers are attacking!", vbCritical
youpower = youpower - 4
losecheck
ElseIf whatattacking = "artillery" Then
MsgBox "Their artillery are attacking!", vbCritical
youpower = youpower - 2
losecheck
End If
End If
responsedisable2
Timer2.Enabled = False
Timer1.Enabled = True
End Sub
Sub responsedisable2()
tanksrespond.Enabled = False
infantryrespond.Enabled = False
fightersrespond.Enabled = False
bombersrespond.Enabled = False
submarinesrespond.Enabled = False
battleshipsrespond.Enabled = False
destroyersrespond.Enabled = False
cruisersrespond.Enabled = False
artilleryrespond.Enabled = False
End Sub
Private Sub artillerydeploy_Click()
If cash < 500 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
artilleryown = True
cash = cash - 500
cashset
artillerydeploy.Enabled = False
End If
End Sub
Private Sub artilleryrespond_Click()
youdefending = True
artilleryfight
End Sub
Private Sub australiaally_Click()
If numallys < maxallys Then
numallys = numallys + 1
australiaallied = True
australiaally.Enabled = False
australiawar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with Australia instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub australiawar_Click()
numallys = numallys - 1
australiaallied = False
australiaally.Enabled = True
australiawar.Enabled = False
End Sub
Private Sub battleshipsdeploy_Click()
If cash < 1200 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
battleshipsown = True
cash = cash - 1200
cashset
battleshipsdeploy.Enabled = False
End If
End Sub
Private Sub battleshipsrespond_Click()
youdefending = True
battleshipsfight
End Sub
Private Sub bombersdeploy_Click()
If cash < 1500 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
bombersown = True
cash = cash - 1500
cashset
bombersdeploy.Enabled = False
End If
End Sub
Private Sub bombersrespond_Click()
youdefending = True
bombersfight
End Sub
Private Sub brazilally_Click()
If numallys < maxallys Then
numallys = numallys + 1
brazilallied = True
brazilally.Enabled = False
brazilwar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with Brazil instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub brazilwar_Click()
numallys = numallys - 1
brazilallied = False
brazilally.Enabled = True
brazilwar.Enabled = False
End Sub
Private Sub britainally_Click()
If numallys < maxallys Then
numallys = numallys + 1
britainallied = True
britainally.Enabled = False
britainwar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with Britain instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub britainwar_Click()
numallys = numallys - 1
britainallied = False
britainally.Enabled = True
britainwar.Enabled = False
End Sub
Private Sub canadaally_Click()
If numallys < maxallys Then
numallys = numallys + 1
canadaallied = True
canadaally.Enabled = False
canadawar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with Canada instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub canadawar_Click()
numallys = numallys - 1
canadaallied = False
canadaally.Enabled = True
canadawar.Enabled = False
End Sub
Private Sub chinaally_Click()
If numallys < maxallys Then
numallys = numallys + 1
chinaallied = True
chinaally.Enabled = False
chinawar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with China instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub chinawar_Click()
numallys = numallys - 1
chinaallied = False
chinaally.Enabled = True
chinawar.Enabled = False
End Sub
Private Sub Command1_Click()
MsgBox "U.S.A.'s power is:" & youpower, vbInformation
End Sub
Private Sub Command10_Click()
MsgBox "Remember to look for Attack & Assault coming July 2004!", vbInformation, "Domination"
frmcredits.Show
Unload Me
End Sub
Private Sub Command11_Click()
MsgBox "China's power is:" & chinapower, vbInformation
End Sub
Private Sub Command2_Click()
MsgBox "Britain's power is:" & britainpower, vbInformation
End Sub
Private Sub Command3_Click()
MsgBox "France's power is:" & francepower, vbInformation
End Sub
Private Sub Command4_Click()
MsgBox "Germany's power is:" & germanypower, vbInformation
End Sub
Private Sub Command5_Click()
MsgBox "Russia's power is:" & russiapower, vbInformation
End Sub
Private Sub Command6_Click()
MsgBox "Canada's power is:" & canadapower, vbInformation
End Sub
Private Sub Command7_Click()
MsgBox "Australia's power is:" & australiapower, vbInformation
End Sub
Private Sub Command8_Click()
MsgBox "Brazil's power is:" & brazilpower, vbInformation
End Sub
Private Sub Command9_Click()
MsgBox "Japan's power is:" & japanpower, vbInformation
End Sub
Private Sub cruisersdeploy_Click()
If cash < 1000 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
cruisersown = True
cash = cash - 1000
cashset
cruisersdeploy.Enabled = False
End If
End Sub
Private Sub cruisersrespond_Click()
youdefending = True
cruisersfight
End Sub
Private Sub destroyersdeploy_Click()
If cash < 850 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
destroyersown = True
cash = cash - 850
cashset
destroyersdeploy.Enabled = False
End If
End Sub
Private Sub destroyersrespond_Click()
youdefending = True
destroyersfight
End Sub
Private Sub fightersdeploy_Click()
If cash < 1000 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
fightersown = True
cash = cash - 1000
cashset
fightersdeploy.Enabled = False
End If
End Sub
Private Sub fightersrespond_Click()
youdefending = True
fightersfight
End Sub
Private Sub Form_Load()
init
End Sub
Sub battleshipsfight()
If youattack = True Then
Randomize
If Rnd < 0.8 Then
Randomize
battleshipsattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 6
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 6
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 6
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 6
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 6
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 6
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 6
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 6
chinaoutcheck
Else
GoTo battleshipsattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your battleships were destroyed!", vbCritical
battleshipsown = False
battleshipsdeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "You blew up their tanks!", vbExclamation
Case "infantry"
MsgBox "You blew up their infantry!", vbExclamation
Case "fighters"
MsgBox "Neither of you got a shot off at each other.", vbInformation
Case "bombers"
MsgBox "The bombers blew up your battleships.", vbCritical
battleshipsown = False
battleshipsdeploy.Enabled = True
youpower = youpower - 4
losecheck
Case "submarines"
MsgBox "The subs sank your battleships!", vbCritical
battleshipsown = False
battleshipsdeploy.Enabled = True
youpower = youpower - 1
losecheck
Case "destroyers"
MsgBox "The destroyers sank your battleships!", vbCritical
battleshipsown = False
battleshipsdeploy.Enabled = True
youpower = youpower - 2
losecheck
Case "battleships"
MsgBox "You never located them.", vbInformation
Case "cruisers"
MsgBox "Your battleships blew up their cruisers.", vbExclamation
Case "artillery"
MsgBox "You blew up their artillery!", vbExclamation
End Select
End If
End Sub
Sub init()
'Make it so you have no units
tanksown = False
infantryown = False
fightersown = False
bombersown = False
submarinesown = False
battleshipsown = False
destroyersown = False
cruisersown = False
artilleryown = False
' Make it so that you have no friends. Boo-Hoo :(
britainallied = False
franceallied = False
germanyallied = False
russiaallied = False
canadaallied = False
australiaallied = False
brazilallied = False
japanallied = False
chinaallied = False
numallys = 0
maxallys = 5
cash = 5000
cashset
britainpower = 20
francepower = 15
germanypower = 15
russiapower = 30
canadapower = 20
australiapower = 19
brazilpower = 10
japanpower = 25
chinapower = 25
youpower = 35
youdefending = False
End Sub
Sub responseenable()
If tanksown = True Then ' Check if you have tanks
tanksrespond.Enabled = True
End If
If infantryown = True Then ' Check if you have infantry
infantryrespond.Enabled = True
End If
If fightersown = True Then ' Check if you have fighters
fightersrespond.Enabled = True
End If
If bombersown = True Then ' Check if you have bombers
bombersrespond.Enabled = True
End If
If submarinesown = True Then ' Check if you have subs
submarinesrespond.Enabled = True
End If
If battleshipsown = True Then 'Check if you have battleships
battleshipsrespond.Enabled = True
End If
If destroyersown = True Then ' Check if you have destroyers
destroyersrespond.Enabled = True
End If
If cruisersown = True Then ' Check if you have cruisers
cruisersrespond.Enabled = True
End If
If artilleryown = True Then ' Check if you have artillery
artilleryrespond.Enabled = True
End If
Timer2.Enabled = True
Timer1.Enabled = False
End Sub
Sub readyattackyou()
MsgBox "Your troops are ready for attack! Deploy the troops of your choice by clicking on them in the battle tab.", vbExclamation, "Domination"
youattack = True
responseenable
End Sub
Sub randomattackenemy()
Randomize 'Randomize the random number
randomcountry (Rnd * 10) ' Get a random attacker
Randomize ' Randomize the random number
randomunit (Rnd * 10) ' Get what the enemy units will be
MsgBox whoattacking & " is attacking you with " & whatattacking & "!", vbCritical, "Domination"
youattack = False
responseenable
End Sub
Sub randomcountry(cntry)
' I'm not going to be able to comment during this sub, but here's what we're doin'.
' What we're gonna do is pretty basic.
' We're going to get a random country.
If cntry < 1 And britainallied = False Then
whoattacking = "Great Britain"
ElseIf cntry > 1 And cntry < 2 And franceallied = False Then
whoattacking = "France"
ElseIf cntry > 2 And cntry < 3 And germanyallied = False Then
whoattacking = "Germany"
ElseIf cntry > 3 And cntry < 4 And russiaallied = False Then
whoattacking = "Russia"
ElseIf cntry > 4 And cntry < 5 And canadaallied = False Then
whoattacking = "Canada"
ElseIf cntry > 5 And cntry < 6 And australiaallied = False Then
whoattacking = "Australia"
ElseIf cntry > 6 And cntry < 7 And brazilallied = False Then
whoattacking = "Brazil"
ElseIf cntry > 7 And cntry < 8 And japanallied = False Then
whoattacking = "Japan"
ElseIf cntry > 8 And cntry < 10 And chinaallied = False Then
whoattacking = "China"
Else
whoattacking = "Rebellion Force"
End If
End Sub
Sub randomunit(unit)
'Now we get a random unit
If unit < 1 Then
whatattacking = "tanks"
ElseIf unit > 1 And unit < 2 Then
whatattacking = "infantry"
ElseIf unit > 2 And unit < 3 Then
whatattacking = "fighters"
ElseIf unit > 3 And unit < 4 Then
whatattacking = "bombers"
ElseIf unit > 4 And unit < 5 Then
whatattacking = "submarines"
ElseIf unit > 5 And unit < 6 Then
whatattacking = "battleships"
ElseIf unit > 6 And unit < 7 Then
whatattacking = "destroyers"
ElseIf unit > 7 And unit < 8 Then
whatattacking = "cruisers"
Else
whatattacking = "artillery"
End If
End Sub
Private Sub fraceally_Click()
If numallys <= maxallys Then
numallys = numallys + 1
franceallied = True
franceally.Enabled = False
francewar.Enabled = True
Else
MsgBox "You have to many allys! Declare war on an ally if you want to ally with France instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub franceally_Click()
If numallys < maxallys Then
numallys = numallys + 1
franceallied = True
franceally.Enabled = False
francewar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with France instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub francewar_Click()
numallys = numallys - 1
franceallied = False
franceally.Enabled = True
francewar.Enabled = False
End Sub
Private Sub germanyally_Click()
If numallys < maxallys Then
numallys = numallys + 1
germanyallied = True
germanyally.Enabled = False
germanywar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with Germany instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub germanywar_Click()
numallys = numallys - 1
germanyallied = False
germanyally.Enabled = True
germanywar.Enabled = False
End Sub
Private Sub infantrydeploy_Click()
If cash < 300 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
infantryown = True
cash = cash - 300
cashset
infantrydeploy.Enabled = False
End If
End Sub
Private Sub infantryrespond_Click()
youdefending = True
infantryfight
End Sub
Private Sub japanally_Click()
If numallys < maxallys Then
numallys = numallys + 1
japanallied = True
japanally.Enabled = False
japanwar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with Japan instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub japanwar_Click()
numallys = numallys - 1
japanallied = False
japanally.Enabled = True
japanwar.Enabled = False
End Sub
Private Sub russiaally_Click()
If numallys < maxallys Then
numallys = numallys + 1
russiaallied = True
russiaally.Enabled = False
russiawar.Enabled = True
Else
MsgBox "You have to many allies! Declare war on an ally if you want to ally with Russia instead.", vbExclamation, "Domination"
End If
End Sub
Private Sub russiawar_Click()
numallys = numallys - 1
russiaallied = False
russiaally.Enabled = True
russiawar.Enabled = False
End Sub
Private Sub submarinesdeploy_Click()
If cash < 900 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
submarinesown = True
cash = cash - 900
cashset
submarinesdeploy.Enabled = False
End If
End Sub
Private Sub submarinesrespond_Click()
youdefending = True
submarinesfight
End Sub
Private Sub tanksdeploy_Click()
If cash < 700 Then
MsgBox "Insufficient funds! Get more money by destroying countrys.", vbExclamation, "Domination"
Else
tanksown = True
cash = cash - 700
cashset
tanksdeploy.Enabled = False
End If
End Sub
Private Sub tanksrespond_Click()
youdefending = True
tanksfight
End Sub
Private Sub Timer1_Timer()
Randomize 'Get a random number
If Rnd * 10 < 4 Then
readyattackyou
Else
randomattackenemy
End If
End Sub
Sub cashset()
Label3.Caption = cash
End Sub
Sub tanksfight()
If youattack = True Then
Randomize
If Rnd < 0.7 Then
Randomize
tanksattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 2
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 2
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 2
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 2
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 2
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 2
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 2
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 2
chinaoutcheck
Else
GoTo tanksattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your tanks were destroyed!", vbCritical
tanksown = False
tanksdeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "You fought off their tanks!", vbExclamation
Case "infantry"
MsgBox "You fought off their infantry!", vbExclamation
Case "fighters"
MsgBox "Neither of you got a shot off at each other.", vbInformation
Case "bombers"
MsgBox "The bombers blew up your tanks.", vbCritical
tanksown = False
tanksdeploy.Enabled = True
youpower = youpower - 4
losecheck
Case "submarines"
MsgBox "You managed to scare off their subs.", vbInformation
Case "destroyers"
MsgBox "The destroyers blew up your tanks.", vbCritical
tanksown = False
tanksdeploy.Enabled = True
youpower = youpower - 2
losecheck
Case "battleships"
MsgBox "The battleships blew up your tanks.", vbCritical
tanksown = False
tanksdeploy.Enabled = True
youpower = youpower - 5
losecheck
Case "cruisers"
MsgBox "The cruisers shot, but missed.", vbInformation
Case "artillery"
MsgBox "You fought off their artillery!", vbExclamation
End Select
End If
End Sub
Sub cruisersfight()
If youattack = True Then
Randomize
If Rnd < 0.6 Then
Randomize
cruisersattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 4
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 4
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 4
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 4
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 4
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 4
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 4
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 4
chinaoutcheck
Else
GoTo cruisersattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your cruisers were destroyed!", vbCritical
cruisersown = False
cruisersdeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "You blew up their tanks!", vbExclamation
Case "infantry"
MsgBox "You killed their infantry!", vbExclamation
Case "fighters"
MsgBox "Neither of you got a shot off at each other.", vbInformation
Case "bombers"
MsgBox "The bombers blew up your cruisers.", vbCritical
cruisersown = False
cruisersdeploy.Enabled = True
youpower = youpower - 4
losecheck
Case "submarines"
MsgBox "The subs sank your cruisers!", vbCritical
cruisersown = False
cruisersdeploy.Enabled = True
youpower = youpower - 1
losecheck
Case "destroyers"
MsgBox "You sank their destroyers!", vbExclamation
Case "battleships"
MsgBox "The battleships sank your cruisers!", vbCritical
cruisersown = False
cruisersdeploy.Enabled = True
youpower = youpower - 5
losecheck
Case "cruisers"
MsgBox "You sank their cruisers!", vbExclamation
Case "artillery"
MsgBox "You destroyed their artillery!", vbExclamation
End Select
End If
End Sub
Sub artilleryfight()
If youattack = True Then
Randomize
If Rnd < 0.6 Then
Randomize
artilleryattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 2
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 2
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 2
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 2
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 2
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 2
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 2
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 2
chinaoutcheck
Else
GoTo artilleryattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your artillery were destroyed!", vbCritical
artilleryown = False
artillerydeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "Their tanks blew up your artillery!", vbCritical
artilleryown = False
artillerydeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "infantry"
MsgBox "You killed their infantry!", vbExclamation
Case "fighters"
MsgBox "Neither of you got a shot off at each other.", vbInformation
Case "bombers"
MsgBox "The bombers blew up your artillery!", vbCritical
artilleryown = False
artillerydeploy.Enabled = True
youpower = youpower - 4
losecheck
Case "submarines"
MsgBox "You sank their subs!", vbExclamation
Case "destroyers"
MsgBox "The destroyers blew up your artillery!", vbCritical
artilleryown = False
artillerydeploy.Enabled = True
youpower = youpower - 2
losecheck
Case "battleships"
MsgBox "The battleships blew up your artillery!", vbCritical
artilleryown = False
artillerydeploy.Enabled = True
youpower = youpower - 5
losecheck
Case "cruisers"
MsgBox "The cruisers destroyed your artillery!", vbCritical
artilleryown = False
artillerydeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "artillery"
MsgBox "The battle was abandoned.", vbInformation
End Select
End If
End Sub
Sub infantryfight()
If youattack = True Then
Randomize
If Rnd < 0.4 Then
Randomize
infantryattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 1
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 1
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 1
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 1
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 1
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 1
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 1
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 1
chinaoutcheck
Else
GoTo infantryattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your infantry were destroyed!", vbCritical
infantryown = False
infantrydeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "Their tanks blew up your infantry!", vbCritical
infantryown = False
infantrydeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "infantry"
MsgBox "You fought off their infantry!", vbExclamation
Case "fighters"
MsgBox "Neither of you got a shot off at each other.", vbInformation
Case "bombers"
MsgBox "The bombers blew up your infantry.", vbCritical
infantryown = False
infantrydeploy.Enabled = True
youpower = youpower - 4
losecheck
Case "submarines"
MsgBox "You managed to scare off their subs.", vbInformation
Case "destroyers"
MsgBox "The destroyers blew up your infantry.", vbCritical
infantryown = False
infantrydeploy.Enabled = True
youpower = youpower - 2
losecheck
Case "battleships"
MsgBox "The battleships blew up your infantry.", vbCritical
infantryown = False
infantrydeploy.Enabled = True
youpower = youpower - 5
losecheck
Case "cruisers"
MsgBox "Your infantry managed to miraculously survive a shelling by the cruisers.", vbInformation
Case "artillery"
MsgBox "The artillery blew up your infantry!", vbCritical
infantryown = False
infantrydeploy.Enabled = True
youpower = youpower - 3
losecheck
End Select
End If
End Sub
Sub destroyersfight()
If youattack = True Then
Randomize
If Rnd < 0.7 Then
Randomize
destroyersattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 3
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 3
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 3
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 3
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 3
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 3
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 3
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 3
chinaoutcheck
Else
GoTo destroyersattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your destroyers were destroyed!", vbCritical
destroyersown = False
destroyersdeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "You blocked the advancment of their tanks!", vbExclamation
Case "infantry"
MsgBox "You killed their infantry!", vbExclamation
Case "fighters"
MsgBox "You shot down their fighters!", vbExclamation
Case "bombers"
MsgBox "You shot down their bombers!", vbExclamation
Case "submarines"
MsgBox "You depth-charged their subs!", vbExclamation
Case "destroyers"
MsgBox "You sank their destroyers!", vbExclamation
Case "battleships"
MsgBox "The battleships sank your destroyers!", vbCritical
destroyersown = False
destroyersdeploy.Enabled = True
youpower = youpower - 5
losecheck
Case "cruisers"
MsgBox "The cruisers sank your destroyers!", vbCritical
destroyersown = False
destroyersdeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "artillery"
MsgBox "You destroyed their artillery!", vbExclamation
End Select
End If
End Sub
Sub submarinesfight()
If youattack = True Then
Randomize
If Rnd < 0.4 Then
Randomize
submarinesattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 1
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 1
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 1
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 1
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 1
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 1
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 1
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 1
chinaoutcheck
Else
GoTo submarinesattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your submarines were destroyed!", vbCritical
submarinesown = False
submarinesdeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "Their tanks blew up your submarines!", vbCritical
submarinesown = False
submarinesdeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "infantry"
MsgBox "The attack was uneventful.", vbInformation
Case "fighters"
MsgBox "The attack was uneventful.", vbInformation
Case "bombers"
MsgBox "The bombers blew up your submarines!", vbCritical
submarinesown = False
submarinesdeploy.Enabled = True
youpower = youpower - 4
losecheck
Case "submarines"
MsgBox "You sank their submarines!", vbExclamation
Case "destroyers"
MsgBox "The destroyers sank your submarines.", vbCritical
submarinesown = False
submarinesdeploy.Enabled = True
youpower = youpower - 2
losecheck
Case "battleships"
MsgBox "You sank their battleships!", vbExclamation
Case "cruisers"
MsgBox "You sank their cruisers!", vbExclamation
Case "artillery"
MsgBox "The artillery sank your submarines!", vbCritical
submarinesown = False
submarinesdeploy.Enabled = True
youpower = youpower - 2
losecheck
End Select
End If
End Sub
Sub bombersfight()
If youattack = True Then
Randomize
If Rnd < 0.6 Then
Randomize
bombersattack:
If Rnd < 0.1 And britainallied = False Then
MsgBox "Your attack on Great Britain was succesful!", vbExclamation
britainpower = britainpower - 5
britainoutcheck
ElseIf Rnd < 0.2 And Rnd > 0.3 And franceallied = False Then
MsgBox "Your attack on France was succesful!", vbExclamation
francepower = francepower - 5
franceoutcheck
ElseIf Rnd < 0.3 And Rnd > 0.4 And germanyallied = False Then
MsgBox "Your attack on Germany was succesful!", vbExclamation
germanypower = germanypower - 5
germanyoutcheck
ElseIf Rnd < 0.4 And Rnd > 0.5 And russiaallied = False Then
MsgBox "Your attack on Russia was succesful!", vbExclamation
russiapower = russiapower - 5
russiaoutcheck
ElseIf Rnd < 0.5 And Rnd > 0.6 And australiaallied = False Then
MsgBox "Your attack on Australia was succesful!", vbExclamation
australiapower = australiapower - 5
australiaoutcheck
ElseIf Rnd < 0.6 And Rnd > 0.7 And brazilallied = False Then
MsgBox "Your attack on Brazil was succesful!", vbExclamation
brazilpower = brazilpower - 5
braziloutcheck
ElseIf Rnd < 0.7 And Rnd > 0.8 And japanallied = False Then
MsgBox "Your attack on Japan was succesful!", vbExclamation
japanpower = japanpower - 5
japanoutcheck
ElseIf Rnd > 0.8 And chinaallied = False Then
MsgBox "Your attack on China was succesful!", vbExclamation
chinapower = chinapower - 5
chinaoutcheck
Else
GoTo bombersattack
End If
cash = cash + 500
cashset
Else
MsgBox "Your bombers were destroyed!", vbCritical
bombersown = False
bombersdeploy.Enabled = True
End If
Else
Select Case whatattacking
Case "tanks"
MsgBox "You blew up their tanks!", vbExclamation
Case "infantry"
MsgBox "You blew up their infantry!", vbExclamation
Case "fighters"
MsgBox "The fighters shot you down!", vbCritical
bombersown = False
bombersdeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "bombers"
MsgBox "You saw the bombers but could do nothing.", vbInformation
Case "submarines"
MsgBox "You blew up their subs.", vbExclamation
Case "destroyers"
MsgBox "The destroyers shot down your bombers.", vbCritical
bombersown = False
bombersdeploy.Enabled = True
youpower = youpower - 3
losecheck
Case "battleships"
MsgBox "You blew up their battleships.", vbExclamation
Case "cruisers"
MsgBox "You blew up their cruisers.", vbExclamation
Case "artillery"
MsgBox "You blew up their artillery!", vbExclamation
End Select
End If
End Sub
Sub britainoutcheck()
If britainpower < 1 Then
MsgBox "Great Britain has fallen!", vbExclamation
britainally.Enabled = False
britainwar.Enabled = False
britainallied = True
wincheck
End If
End Sub
Sub franceoutcheck()
If francepower < 1 Then
MsgBox "France has fallen!", vbExclamation
franceally.Enabled = False
francewar.Enabled = False
franceallied = True
wincheck
End If
End Sub
Sub germanyoutcheck()
If germanypower < 1 Then
MsgBox "Germany has fallen!", vbExclamation
germanyally.Enabled = False
germanywar.Enabled = False
germanyallied = True
wincheck
End If
End Sub
Sub russiaoutcheck()
If russiapower < 1 Then
MsgBox "Russia has fallen!", vbExclamation
russiaally.Enabled = False
russiawar.Enabled = False
russiaallied = True
wincheck
End If
End Sub
Sub canadaoutcheck()
If canadapower < 1 Then
MsgBox "Canada has fallen!", vbExclamation
canadaally.Enabled = False
canadawar.Enabled = False
canadaallied = True
wincheck
End If
End Sub
Sub australiaoutcheck()
If australiapower < 1 Then
MsgBox "Australia has fallen!", vbExclamation
australiaally.Enabled = False
australiawar.Enabled = False
australiaallied = True
wincheck
End If
End Sub
Sub braziloutcheck()
If brazilpower < 1 Then
MsgBox "Brazil has fallen!", vbExclamation
brazilally.Enabled = False
brazilwar.Enabled = False
brazilallied = True
wincheck
End If
End Sub
Sub japanoutcheck()
If japanpower < 1 Then
MsgBox "Japan has fallen!", vbExclamation
japanally.Enabled = False
japanwar.Enabled = False
japanallied = True
wincheck
End If
End Sub
Sub chinaoutcheck()
If chinapower < 1 Then
MsgBox "China has fallen!", vbExclamation
chinaally.Enabled = False
chinawar.Enabled = False
chinaallied = True
wincheck
End If
End Sub
Sub wincheck()
If britainallied = True And franceallied = True And germanyallied = True And russiaallied = True And canadaallied = True And australiaallied = True And brazilallied = True And japanallied = True And chinaallied = True Then
Dim playagain
playagain = MsgBox("Congratulation! You have succesfully led the U.S.A. to victory! Would you like to play again?", vbQuestion + vbYesNo)
If playagain = vbYes Then
frmMain.Show
Unload Me
Else
frmcredits.Show
Unload Me
End If
End If
End Sub
Sub losecheck()
If youpower < 1 Then
MsgBox "You have failed in the mission of all missions. You will be court-martialed for failing.", vbCritical + vbOKOnly
frmMain.Show
Unload Me
End If
End Sub
Private Sub Timer2_Timer()
responsedisable
End Sub
Here's a full-size screenshot of Ultra-Sub in VB:

Create twelve timers and name them:
enemycome resetall enemyfire moveenemy2 apache1mover apache2mover tank1mover tank2mover infantry1mover infantry2mover infantry3mover
'******************************************
'Ultra-Sub Copyright 2004 JMRS Development
'******************************************
Option Explicit
Dim exitq
Dim score As Integer
Dim tomove As String
Dim apache1moves As Integer
Dim apache2moves As Integer
Dim sub1moves As Integer
Dim sub2moves As Integer
Dim ship1moves As Integer
Dim ship2moves As Integer
Dim ship3moves As Integer
Dim youdirection As String
Dim apache1direction As String
Dim apache2direction As String
Dim sub1direction As String
Dim sub2direction As String
Dim ship1direction As String
Dim ship2direction As String
Dim ship3direction As String
Dim Dx As New DirectX7
Dim Ds As DirectSound
Dim DsBuffer As DirectSoundBuffer
Dim DsDesc As DSBUFFERDESC
Dim DsWave As WAVEFORMATEX
Dim health As Integer
Private Sub apache1mover_Timer()
apache1move
End Sub
Private Sub apache2mover_Timer()
apache2move
End Sub
Private Sub enemycome_Timer()
makeenemy
End Sub
Sub moveleft()
yousub.Picture = LoadPicture(App.Path & "\yousubl.gif")
yousub.Left = yousub.Left - 200
youdirection = "left"
End Sub
Sub moveright()
yousub.Picture = LoadPicture(App.Path & "\yousubr.gif")
yousub.Left = yousub.Left + 200
youdirection = "right"
End Sub
Sub moveup()
yousub.Picture = LoadPicture(App.Path & "\yousubu.gif")
yousub.Top = yousub.Top - 200
youdirection = "up"
End Sub
Sub movedown()
yousub.Picture = LoadPicture(App.Path & "\yousubd.gif")
yousub.Top = yousub.Top + 200
youdirection = "down"
End Sub
Sub firemain()
Select Case youdirection
Case "down"
firemaindown
Case "up"
firemainup
Case "left"
firemainleft
Case "right"
firemainright
End Select
torpedo
End Sub
Sub fireminigun()
cannon
Select Case youdirection
Case "down"
fireminidown
Case "up"
fireminiup
Case "left"
fireminileft
Case "right"
fireminiright
End Select
End Sub
Sub fireminiright()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If apache1.Left < yousub.Left + 5000 And apache1.Left > yousub.Left And apache1.Visible = True Then
apache1kill
ElseIf apache2.Left < yousub.Left + 5000 And apache2.Left > yousub.Left And apache2.Visible = True Then
apache2kill
ElseIf ship1.Left < yousub.Left + 5000 And ship1.Left > yousub.Left And ship3.Visible = True Then
ship1kill
ElseIf ship2.Left < yousub.Left + 5000 And ship2.Left > yousub.Left And ship2.Visible = True Then
ship2kill
ElseIf ship3.Left < yousub.Left + 5000 And ship3.Left > yousub.Left And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub firemainright()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If esub1.Left < yousub.Left + 2000 And esub1.Left > yousub.Left And esub1.Visible = True Then
sub1kill
ElseIf esub2.Left < yousub.Left + 2000 And esub2.Left > yousub.Left And esub2.Visible = True Then
sub2kill
ElseIf ship1.Left < yousub.Left + 2000 And ship1.Left > yousub.Left And ship3.Visible = True Then
ship1kill
ElseIf ship2.Left < yousub.Left + 2000 And ship2.Left > yousub.Left And ship2.Visible = True Then
ship2kill
ElseIf ship3.Left < yousub.Left + 2000 And ship3.Left > yousub.Left And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub fireminileft()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If apache1.Left > yousub.Left - 2000 And apache1.Left < yousub.Left And apache1.Visible Then
apache1kill
ElseIf apache2.Left > yousub.Left - 2000 And apache2.Left < yousub.Left And apache2.Visible = True Then
apache2kill
ElseIf ship1.Left > yousub.Left - 2000 And ship1.Left < yousub.Left And ship1.Visible = True Then
ship1kill
ElseIf ship2.Left > yousub.Left - 2000 And ship2.Left < yousub.Left And ship2.Visible = True Then
ship2kill
ElseIf ship3.Left > yousub.Left - 2000 And ship3.Left < yousub.Left And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub firemainleft()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If esub1.Left > yousub.Left - 5000 And esub1.Left < yousub.Left And esub1.Visible Then
sub1kill
ElseIf esub2.Left > yousub.Left - 5000 And esub2.Left < yousub.Left And esub2.Visible = True Then
sub2kill
ElseIf ship1.Left > yousub.Left - 5000 And ship1.Left < yousub.Left And ship1.Visible = True Then
ship1kill
ElseIf ship2.Left > yousub.Left - 5000 And ship2.Left < yousub.Left And ship2.Visible = True Then
ship2kill
ElseIf ship3.Left > yousub.Left - 5000 And ship3.Left < yousub.Left And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub fireminiup()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If apache2.Top > yousub.Top - 2000 And apache2.Top < yousub.Top And apache1.Visible = True Then
apache1kill
ElseIf apache2.Top > yousub.Top - 2000 And apache2.Top < yousub.Top And apache2.Visible = True Then
apache2kill
ElseIf ship1.Top > yousub.Top - 2000 And ship1.Top < yousub.Top And ship1.Visible = True Then
ship1kill
ElseIf ship2.Top > yousub.Top - 2000 And ship2.Top < yousub.Top And ship2.Visible = True Then
ship2kill
ElseIf ship3.Top > yousub.Top - 2000 And ship3.Top < yousub.Top And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub firemainup()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If esub2.Top > yousub.Top - 5000 And esub2.Top < yousub.Top And esub1.Visible = True Then
sub1kill
ElseIf esub2.Top > yousub.Top - 5000 And esub2.Top < yousub.Top And esub2.Visible = True Then
sub2kill
ElseIf ship1.Top > yousub.Top - 5000 And ship1.Top < yousub.Top And ship1.Visible = True Then
ship1kill
ElseIf ship2.Top > yousub.Top - 5000 And ship2.Top < yousub.Top And ship2.Visible = True Then
ship2kill
ElseIf ship3.Top > yousub.Top - 5000 And ship3.Top < yousub.Top And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub fireminidown()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If apache1.Top < yousub.Top + 2000 And apache1.Top > yousub.Top And apache1.Visible = True Then
apache1kill
ElseIf apache2.Top < yousub.Top + 2000 And apache2.Top > yousub.Top And apache2.Visible = True Then
apache2kill
ElseIf ship1.Top < yousub.Top + 2000 And ship1.Top > yousub.Top And ship1.Visible = True Then
ship1kill
ElseIf ship2.Top < yousub.Top + 2000 And ship2.Top > yousub.Top And ship2.Visible = True Then
ship2kill
ElseIf ship3.Top < yousub.Top + 2000 And ship3.Top > yousub.Top And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub firemaindown()
bullet.Left = yousub.Left: bullet.Top = yousub.Top
If esub1.Top < yousub.Top + 5000 And esub1.Top > yousub.Top And esub1.Visible = True Then
sub1kill
ElseIf esub2.Top < yousub.Top + 5000 And esub2.Top > yousub.Top And esub2.Visible = True Then
sub2kill
ElseIf ship1.Top < yousub.Top + 5000 And ship1.Top > yousub.Top And ship1.Visible = True Then
ship1kill
ElseIf ship2.Top < yousub.Top + 5000 And ship2.Top > yousub.Top And ship2.Visible = True Then
ship2kill
ElseIf ship3.Top < yousub.Top + 5000 And ship3.Top > yousub.Top And ship3.Visible = True Then
ship3kill
End If
End Sub
Sub makeenemy()
Randomize
If Rnd < 0.333 Then
makeapache
ElseIf Rnd > 0.333 And Rnd < 0.667 Then
makesub
ElseIf Rnd > 0.667 Then
makeship
End If
End Sub
Sub makeapache()
helo
If apache1.Visible = False And apache2.Visible = False Then
apache1.Visible = True
ElseIf apache1.Visible = True And apache2.Visible = False Then
apache2.Visible = True
End If
End Sub
Sub makesub()
subship
If esub1.Visible = False And esub2.Visible = False Then
esub1.Visible = True
ElseIf esub1.Visible = True And esub2.Visible = False Then
esub2.Visible = True
End If
End Sub
Sub makeship()
subship
If ship1.Visible = False And ship2.Visible = False Then
ship1.Visible = True
ElseIf ship1.Visible = True And ship2.Visible = False Then
ship2.Visible = True
ElseIf ship2.Visible = False And ship3.Visible = False Then
ship3.Visible = True
End If
End Sub
Sub apache1kill()
apache1.Top = 2760
apache1.Left = 9240
apache1.Visible = False
score = score + 10
setscore
wincheck
End Sub
Sub apache2kill()
apache2.Top = 2760
apache2.Left = 9240
apache2.Visible = False
score = score + 10
setscore
wincheck
End Sub
Sub sub1kill()
esub1.Top = 2760
esub1.Left = 9240
esub1.Visible = False
score = score + 5
setscore
wincheck
End Sub
Sub sub2kill()
esub2.Top = 2760
esub2.Left = 9240
esub2.Visible = False
score = score + 5
setscore
wincheck
End Sub
Sub ship1kill()
ship1.Top = 2760
ship1.Left = 9240
ship1.Visible = False
score = score + 3
setscore
wincheck
End Sub
Sub ship2kill()
ship2.Top = 2760
ship2.Left = 9240
ship2.Visible = False
score = score + 3
setscore
wincheck
End Sub
Sub ship3kill()
ship3.Top = 2760
ship3.Left = 9240
ship3.Visible = False
score = score + 3
setscore
wincheck
End Sub
Sub moveenemy(tomovepass As String)
Select Case tomovepass
Case "apache1"
apache1mover.Enabled = True
Case "apache2"
apache2mover.Enabled = True
Case "sub1"
tank1mover.Enabled = True
Case "sub2"
tank2mover.Enabled = True
Case "ship1"
infantry1mover.Enabled = True
Case "ship2"
infantry2mover.Enabled = True
Case "ship3"
infantry3mover.Enabled = True
End Select
End Sub
Private Sub enemyfire_Timer()
Randomize
Dim rnd2
rnd2 = Rnd * 10
If rnd2 < 1.25 And apache1.Visible = True Then
apache1fire
score = score - 10: setscore
losecheck
ElseIf rnd2 > 1.25 And rnd2 < 2.5 And apache2.Visible = True Then
apache2fire
score = score - 10: setscore
losecheck
ElseIf rnd2 > 2.5 And rnd2 < 3.75 And esub1.Visible = True Then
sub1fire
score = score - 5: setscore
losecheck
ElseIf rnd2 > 3.25 And rnd2 < 5 And esub2.Visible = True Then
sub2fire
score = score - 5: setscore
losecheck
ElseIf rnd2 > 5 And rnd2 < 6.5 And ship1.Visible = True Then
ship1fire
score = score - 3: setscore
losecheck
ElseIf rnd2 > 6.5 And rnd2 < 8 And ship2.Visible = True Then
ship2fire
score = score - 3: setscore
losecheck
ElseIf rnd2 > 8 And ship3.Visible = True Then
ship3fire
score = score - 3: setscore
losecheck
End If
End Sub
Sub apache2fire()
rocket
Select Case apache2direction
Case "left"
If yousub.Left < apache2.Left + 10000 And yousub.Left > apache2.Left Then
health = health - 10
losecheck
End If
Case "right"
If yousub.Left > apache2.Left - 10000 And yousub.Left < apache2.Left Then
health = health - 10
losecheck
End If
Case "up"
If yousub.Top > apache2.Top - 10000 And yousub.Top < apache2.Top Then
health = health - 10
losecheck
End If
Case "down"
If yousub.Top < apache2.Top + 10000 And yousub.Top > apache2.Top Then
health = health - 10
losecheck
End If
End Select
End Sub
Sub sub1fire()
torpedo
Select Case sub1direction
Case "left"
If yousub.Left < esub1.Left + 5000 And yousub.Left > esub1.Left Then
health = health - 5
losecheck
End If
Case "right"
If yousub.Left > esub1.Left - 5000 And yousub.Left < esub1.Left Then
health = health - 5
losecheck
End If
Case "up"
If yousub.Top > esub1.Top - 5000 And yousub.Top < esub1.Top Then
health = health - 5
losecheck
End If
Case "down"
If yousub.Top < esub1.Top + 5000 And yousub.Top > esub1.Top Then
health = health - 5
losecheck
End If
End Select
End Sub
Sub sub2fire()
torpedo
Select Case sub1direction
Case "left"
If yousub.Left < esub2.Left + 5000 And yousub.Left > esub2.Left Then
health = health - 5
losecheck
End If
Case "right"
If yousub.Left > esub2.Left - 5000 And yousub.Left < esub2.Left Then
health = health - 5
losecheck
End If
Case "up"
If yousub.Top > esub2.Top - 5000 And yousub.Top < esub2.Top Then
health = health - 5
losecheck
End If
Case "down"
If yousub.Top < esub2.Top + 5000 And yousub.Top > esub2.Top Then
health = health - 5
losecheck
End If
End Select
End Sub
Sub ship1fire()
cannon
Select Case ship1direction
Case "left"
If yousub.Left < ship1.Left + 5000 And yousub.Left > ship1.Left Then
health = health - 1
losecheck
End If
Case "right"
If yousub.Left > ship1.Left - 5000 And yousub.Left < ship1.Left Then
health = health - 1
losecheck
End If
Case "up"
If yousub.Top > ship1.Top - 5000 And yousub.Top < ship1.Top Then
health = health - 1
losecheck
End If
Case "down"
If yousub.Top < ship1.Top + 5000 And yousub.Top > ship1.Top Then
health = health - 1
losecheck
End If
End Select
End Sub
Sub ship2fire()
cannon
Select Case ship2direction
Case "left"
If yousub.Left < ship2.Left + 5000 And yousub.Left > ship2.Left Then
health = health - 1
losecheck
End If
Case "right"
If yousub.Left > ship2.Left - 5000 And yousub.Left < ship2.Left Then
health = health - 1
losecheck
End If
Case "up"
If yousub.Top > ship2.Top - 5000 And yousub.Top < ship2.Top Then
health = health - 1
losecheck
End If
Case "down"
If yousub.Top < ship2.Top + 5000 And yousub.Top > ship2.Top Then
health = health - 1
losecheck
End If
End Select
End Sub
Sub ship3fire()
cannon
Select Case ship1direction
Case "left"
If yousub.Left < ship3.Left + 5000 And yousub.Left > ship3.Left Then
health = health - 1
losecheck
End If
Case "right"
If yousub.Left > ship3.Left - 5000 And yousub.Left < ship3.Left Then
health = health - 1
losecheck
End If
Case "up"
If yousub.Top > ship3.Top - 5000 And yousub.Top < ship3.Top Then
health = health - 1
losecheck
End If
Case "down"
If yousub.Top < ship3.Top + 5000 And yousub.Top > ship3.Top Then
health = health - 1
losecheck
End If
End Select
End Sub
Sub losecheck()
Static playagain As Variant
If score < -49 Then
losesound
playagain = MsgBox("Game Over. Do you want to play again?", vbYesNo + vbQuestion, "Game Over")
Select Case playagain
Case vbNo
frmCredits.Show
Unload Me
Case vbYes
frmStart.Show
Unload Me
End Select
End If
End Sub
Sub apache1fire()
rocket
Select Case apache1direction
Case "left"
If yousub.Left < apache1.Left + 10000 And yousub.Left > apache1.Left Then
health = health - 10
losecheck
End If
Case "right"
If yousub.Left > apache1.Left - 10000 And yousub.Left < apache1.Left Then
health = health - 10
losecheck
End If
Case "up"
If yousub.Top > apache1.Top - 10000 And yousub.Top < apache1.Top Then
health = health - 10
losecheck
End If
Case "down"
If yousub.Top < apache1.Top + 10000 And yousub.Top > apache1.Top Then
health = health - 10
losecheck
End If
End Select
End Sub
Private Sub Form_DblClick()
score = score + 5
setscore
wincheck
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case 27
exitq = MsgBox("Are you sure you want to quit?", vbQuestion + vbYesNo)
If exitq = vbYes Then
frmCredits.Show
Unload Me
End If
Case vbKeyLeft
moveleft
Case vbKeyRight
moveright
Case vbKeyDown
movedown
Case vbKeyUp
moveup
Case vbKeySpace
firemain
Case 13
fireminigun
Case vbKeyP
MsgBox "The game is paused. Press OK to resume.", vbInformation, "Paused"
End Select
End Sub
Sub wincheck()
Static playagain As Variant
If score > 100 Then
winsound
playagain = MsgBox("Congratulations! Do you want to play again?", vbQuestion + vbYesNo, "Ultra-sub")
Select Case playagain
Case vbYes
frmStart.Show
Unload Me
Case vbNo
frmCredits.Show
Unload Me
End Select
End If
End Sub
Private Sub Form_Load()
score = 0
enemycome.Interval = 7500
resetall.Interval = 60000
enemyfire.Interval = 1000
moveenemy2.Interval = 1000
apache1mover.Interval = 500
apache2mover.Interval = 500
tank1mover.Interval = 500
tank2mover.Interval = 500
infantry1mover.Interval = 500
infantry2mover.Interval = 500
infantry3mover.Interval = 500
resetenemymoves.Interval = 3000
health = 50
makeship
End Sub
Sub apache1move()
Randomize
If apache1moves < 200 Then
If Rnd < 0.25 Then
apache1.Left = apache1.Left - 700
apache1.Picture = LoadPicture(App.Path & "\apachel.gif")
apache1direction = "left"
ElseIf Rnd < 0.5 And Rnd > 0.25 Then
apache1.Left = apache1.Left + 700
apache1.Picture = LoadPicture(App.Path & "\apacher.gif")
apache1direction = "right"
ElseIf Rnd < 0.75 And Rnd > 0.5 Then
apache1.Top = apache1.Top - 700
apache1.Picture = LoadPicture(App.Path & "\apacheu.gif")
apache1direction = "up"
ElseIf Rnd > 0.75 Then
apache1.Top = apache1.Top + 700
apache1.Picture = LoadPicture(App.Path & "\apached.gif")
apache1direction = "down"
End If: apache1moves = apache1moves + 1
Else
apache1mover.Enabled = False
End If
End Sub
Sub setscore()
Label1.Caption = score
End Sub
Sub apache2move()
Randomize
If apache2moves < 200 Then
If Rnd < 0.25 Then
apache2.Left = apache2.Left - 700
apache2.Picture = LoadPicture(App.Path & "\apachel.gif")
apache2direction = "left"
ElseIf Rnd < 0.5 And Rnd > 0.25 Then
apache2.Left = apache2.Left + 700
apache2.Picture = LoadPicture(App.Path & "\apacher.gif")
apache2direction = "right"
ElseIf Rnd < 0.75 And Rnd > 0.5 Then
apache2.Top = apache2.Top - 700
apache2.Picture = LoadPicture(App.Path & "\apacheu.gif")
apache2direction = "up"
ElseIf Rnd > 0.75 Then
apache2.Top = apache2.Top + 700
apache2.Picture = LoadPicture(App.Path & "\apached.gif")
apache2direction = "down"
End If: apache2moves = apache2moves + 1
Else
apache1mover.Enabled = False
End If
End Sub
Sub sub1move()
Randomize
If sub1moves < 200 Then
If Rnd < 0.25 Then
esub1.Left = esub1.Left - 400
esub1.Picture = LoadPicture(App.Path & "\subl.gif")
sub1direction = "left"
ElseIf Rnd < 0.5 And Rnd > 0.25 Then
esub1.Left = esub1.Left + 400
esub1.Picture = LoadPicture(App.Path & "\subr.gif")
sub1direction = "right"
ElseIf Rnd < 0.75 And Rnd > 0.5 Then
esub1.Top = esub1.Top - 400
esub1.Picture = LoadPicture(App.Path & "\subu.gif")
sub1direction = "up"
ElseIf Rnd > 0.75 Then
esub1.Top = esub1.Top + 400
esub1.Picture = LoadPicture(App.Path & "\subd.gif")
sub1direction = "down"
End If: sub1moves = sub1moves + 1
Else
tank1mover.Enabled = False
End If
End Sub
Sub sub2move()
Randomize
If sub2moves < 200 Then
If Rnd < 0.25 Then
esub2.Left = esub2.Left - 400
esub2.Picture = LoadPicture(App.Path & "\subl.gif")
sub2direction = "left"
ElseIf Rnd < 0.5 And Rnd > 0.25 Then
esub2.Left = esub2.Left + 400
esub2.Picture = LoadPicture(App.Path & "\subr.gif")
sub2direction = "right"
ElseIf Rnd < 0.75 And Rnd > 0.5 Then
esub2.Top = esub2.Top - 400
esub2.Picture = LoadPicture(App.Path & "\subu.gif")
sub2direction = "up"
ElseIf Rnd > 0.75 Then
esub2.Top = esub2.Top + 400
esub2.Picture = LoadPicture(App.Path & "\subd.gif")
sub2direction = "down"
End If: sub2moves = sub2moves + 1
Else
tank2mover.Enabled = False
End If
End Sub
Sub ship1move()
Randomize
If ship1moves < 200 Then
If Rnd < 0.25 Then
ship1.Left = ship1.Left - 700
ship1.Picture = LoadPicture(App.Path & "\shipl.gif")
ship1direction = "left"
ElseIf Rnd < 0.5 And Rnd > 0.25 Then
ship1.Left = ship1.Left + 700
ship1.Picture = LoadPicture(App.Path & "\shipr.gif")
ship1direction = "right"
ElseIf Rnd < 0.75 And Rnd > 0.5 Then
ship1.Top = ship1.Top - 700
ship1.Picture = LoadPicture(App.Path & "\shipu.gif")
ship1direction = "up"
ElseIf Rnd > 0.75 Then
ship1.Top = ship1.Top + 700
ship1.Picture = LoadPicture(App.Path & "\shipd.gif")
ship1direction = "down"
End If: ship1moves = ship1moves + 1
Else
infantry1mover.Enabled = False
End If
End Sub
Sub ship2move()
Randomize
If ship2moves < 200 Then
If Rnd < 0.25 Then
ship2.Left = ship2.Left - 700
ship2.Picture = LoadPicture(App.Path & "\shipl.gif")
ship2direction = "left"
ElseIf Rnd < 0.5 And Rnd > 0.25 Then
ship2.Left = ship2.Left + 700
ship2.Picture = LoadPicture(App.Path & "\shipr.gif")
ship2direction = "right"
ElseIf Rnd < 0.75 And Rnd > 0.5 Then
ship2.Top = ship2.Top - 700
ship2.Picture = LoadPicture(App.Path & "\shipu.gif")
ship2direction = "up"
ElseIf Rnd > 0.75 Then
ship2.Top = ship2.Top + 700
ship2.Picture = LoadPicture(App.Path & "\shipd.gif")
ship2direction = "down"
End If: ship2moves = ship2moves + 1
Else
infantry2mover.Enabled = False
End If
End Sub
Sub ship3move()
Randomize
If ship3moves < 200 Then
If Rnd < 0.25 Then
ship3.Left = ship3.Left - 700
ship3.Picture = LoadPicture(App.Path & "\shipl.gif")
ship3direction = "left"
ElseIf Rnd < 0.5 And Rnd > 0.25 Then
ship3.Left = ship3.Left + 700
ship3.Picture = LoadPicture(App.Path & "\shipr.gif")
ship3direction = "right"
ElseIf Rnd < 0.75 And Rnd > 0.5 Then
ship3.Top = ship3.Top - 700
ship3.Picture = LoadPicture(App.Path & "\shipu.gif")
ship3direction = "up"
ElseIf Rnd > 0.75 Then
ship3.Top = ship3.Top + 700
ship3.Picture = LoadPicture(App.Path & "\shipd.gif")
ship3direction = "down"
End If: ship3moves = ship3moves + 1
Else
infantry3mover.Enabled = False
End If
End Sub
Private Sub infantry1mover_Timer()
ship1move
End Sub
Private Sub infantry2mover_Timer()
ship2move
End Sub
Private Sub infantry3mover_Timer()
ship3move
End Sub
Private Sub moveenemy2_Timer()
Randomize
If Rnd < 0.125 Then
moveenemy "apache1"
ElseIf Rnd < 0.25 And Rnd > 0.125 Then
moveenemy "apache2"
ElseIf Rnd > 0.375 And Rnd < 0.5 Then
moveenemy "sub1"
ElseIf Rnd > 0.5 And Rnd < 0.625 Then
moveenemy "sub2"
ElseIf Rnd > 0.625 And Rnd < 0.75 Then
moveenemy "ship1"
ElseIf Rnd > 0.75 And Rnd < 0.825 Then
moveenemy "ship2"
ElseIf Rnd > 0.825 Then
moveenemy "ship2"
End If
End Sub
Private Sub resetall_Timer()
lightning
apache1.Top = 2760
apache2.Top = 2760
esub1.Top = 2760
esub2.Top = 2760
ship1.Top = 2760
ship2.Top = 2760
ship3.Top = 2760
apache1.Left = 9000
apache2.Left = 9000
esub1.Left = 9000
esub2.Left = 9000
ship1.Left = 9000
ship2.Left = 9000
ship3.Left = 9000
yousub.Top = 2760
yousub.Left = 9000
End Sub
Private Sub resetenemymoves_Timer()
apache1moves = 0
apache2moves = 0
sub1moves = 0
sub2moves = 0
ship1moves = 0
ship2moves = 0
ship3moves = 0
End Sub
Private Sub tank1mover_Timer()
sub1move
End Sub
Private Sub tank2mover_Timer()
sub2move
End Sub
Private Sub youtank_Click()
End Sub
Sub losesound()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\lose.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub
Sub StopSound()
'Stopping it effectively pauses it
DsBuffer.Stop
'Only when you set the current position to 0 will
'it go back to the beginning
DsBuffer.SetCurrentPosition 0
'You can use the SetCurrentPosition to jump around
'a sound file as you like; which can be useful
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call StopSound
End Sub
Sub winsound()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\win.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub
Sub subship()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\subship.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub
Sub helo()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\helo.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub
Sub rocket()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\rocket.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub
Sub torpedo()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\torpedo.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub
Sub cannon()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\cannon.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub
Sub lightning()
Set Ds = Dx.DirectSoundCreate("")
'It is best to check for errors before continuing
If Err.Number <> 0 Then
MsgBox "Unable to Continue, Error creating Directsound object."
Exit Sub
End If
'This tells DX how much we want directsound. If it
'is set to normal DX will allow other programs to use the soundcard
'If it is set to Exclusive ONLY we get to use the soundcard. Which
'is what you want when writing a game...
Ds.SetCooperativeLevel frmWar.hWnd, DSSCL_EXCLUSIVE
'These settings are quite important; what you set here reflects
'in the quality that the sound plays.
'8bit + 1 channel = Poor quality, but less processing time and less memory
'16bit + 2 channels = Good quality, more memory and more processing time
'The comments about processing time and memory will only affect you
'when you start putting a heavy load on the sound card; and/or it is
'playing/storing lots of sound files.
DsDesc.lFlags = DSBCAPS_CTRLFREQUENCY Or DSBCAPS_CTRLPAN Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC
DsWave.nFormatTag = WAVE_FORMAT_PCM 'Sound Must be PCM otherwise we get errors
DsWave.nChannels = 2 '1= Mono, 2 = Stereo
DsWave.lSamplesPerSec = 22050
DsWave.nBitsPerSample = 16 '16 =16bit, 8=8bit
DsWave.nBlockAlign = DsWave.nBitsPerSample / 8 * DsWave.nChannels
DsWave.lAvgBytesPerSec = DsWave.lSamplesPerSec * DsWave.nBlockAlign
'This line creates a sound buffer based on the information you have just
'put in the two structures
Set DsBuffer = Ds.CreateSoundBufferFromFile(App.Path & "\lightninggeyser.Wav", DsDesc, DsWave)
DsBuffer.Play DSBPLAY_DEFAULT
End Sub