Private Sub Form_KeyPress(KeyAscii As Integer)
Dim DelayLaser As Integer
'S/s to move ship right
If (KeyAscii = 83 Or KeyAscii = 115) And imgChar.Left < 8880 Then
imgChar.Left = imgChar.Left + 400
'A/a moves ship left
ElseIf (KeyAscii = 65 Or KeyAscii = 97) And imgChar.Left > -150 Then
imgChar.Left = imgChar.Left - 400
'For the SpaceBar
ElseIf KeyAscii = 32 Then
imgLaser1.Top = imgChar.Top
imgLaser1.Left = imgChar.Left + 1120
imgLaser1.Top = imgChar.Top - 300
For DelayLaser = 1 To 20000
imgLaser1.Top = imgLaser1.Top - 3
hold = DoEvents
Next DelayLaser
imgLaser1.Top = -900
End If
End Sub
Private Sub MnuEExit_Click()
End
End Sub
Private Sub mnuLEasy_Click()
' hMove and vMove record the number of steps
' through each section of the animation
Dim hMove1 As Integer
Dim vMove1 As Integer
Dim hMove2 As Integer
Dim vMove2 As Integer
Dim EnemyDelay As Long
' position the Enemy Object(s)
imgEnemy1.Top = 0
imgEnemy1.Left = 0
'Rate at which the the enemy will move horizontally
hMove = 5
'When Enemy Reaches at the edge it will add its own height and move down
vMove = 500
'Mode When everything has to start
continue = "yes"
'While Continue = "yes" things will start in the loop
While continue = "yes"
' pause to allow motion to be seen
For EnemyDelay = 1 To 40000
Next EnemyDelay
' move the Enemy object by adding 5 twips at a time
imgEnemy1.Left = imgEnemy1.Left + hMove1
imgEnemy2.Left = imgEnemy2.Left + hMove2
'This will check if image is at the edge of the screen
If imgEnemy1.Left = 10000 Then
'If it is then it will change whehter twips will be added or subtracted
'In this case it is going to start subtracting twips
hMove1 = hMove1 * -1
'Add height in twips, that way the image will move down
imgEnemy1.Top = imgEnemy1.Top + vMove1
'Checking if the .Left is at the left side of screen
ElseIf imgEnemy1.Left = 0 Then
'If it is then it will change whehter twips will be added or subtracted
'In this case it is going to start adding twips
hMove1 = hMove1 * -1
'Add height in twips, that way image will move down
imgEnemy1.Top = imgEnemy1.Top + vMove1
End If
If imgEnemy1.Top > 5000 Then
continue = "no"
imgEnemy1.Top = 0
imgEnemy1.Left = 0
End If
If imgEnemy2.Left = 10000 Then
'If it is then it will change whehter twips will be added or subtracted
'In this case it is going to start subtracting twips
hMove2 = hMove2 * -1
'Add height in twips, that way the image will move down
imgEnemy2.Top = imgEnemy2.Top + vMove
'Checking if the .Left is at the left side of screen
ElseIf imgEnemy2.Left = 0 Then
'If it is then it will change whehter twips will be added or subtracted
'In this case it is going to start adding twips
hMove2 = hMove2 * -1
'Add height in twips, that way image will move down
imgEnemy2.Top = imgEnemy2.Top + vMove2
End If
If imgEnemy2.Top > 5000 Then
continue = "no"
imgEnemy2.Top = 0
imgEnemy2.Left = 0
End If
hold = DoEvents
Wend
End Sub