All pastes #64602 Raw Edit

TheLegace

public text v1 · immutable
#64602 ·published 2006-06-11 23:08 UTC
rendered paste body
Private Sub Form_KeyPress(KeyAscii As Integer)
Dim DelayLaser As Long
'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
    While (imgLaser1.Top > imgEnemy1.Top)
        
        For DelayLaser = 1 To 1000000000
        imgLaser1.Top = imgLaser1.Top - 5
        hold = DoEvents
        Next DelayLaser
        Wend
        If imgLaser1.Top = 0 Then
            imgLaser1.Top = 4320
        End If
End If
 
End Sub
 
 
Private Sub mnuLEasy_Click()
' hMove and vMove record the  number of steps
'  through each section of the animation
Dim hMove As Integer
Dim vMove As Integer
Dim delay As Long
' moveFactor indicates which way the face starts
Dim moveFactor As Integer
 
continue = "yes"
' position the face image
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 = 1095
'Mode When everything has to start
continue = "yes"
 
'While Continue = "yes" things will start in the loop
While continue = "yes"
    'To Check if the enemy at the bottom of the Program
    If imgEnemy1.Top = 7860 Then
        'Will turn everything off
        continue = "no"
        'Reset the image back to its original position
        imgEnemy1.Top = 0
        imgEnemy1.Left = 0
    Else
        'Otherwise it will keep going right to left
        While imgEnemy1.Left < 10000
            ' pause to allow motion to be seen
            For delay = 1 To 400000
            ' move the Enemy object by adding 5 twips at a time
            imgEnemy1.Left = imgEnemy1.Left + hMove
  
                '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
                    hMove = hMove * -1
                    'Add height in twips, that way the image will move down
                    imgEnemy1.Top = imgEnemy1.Top + vMove
                '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
                    hMove = hMove * -1
                    'Add height in twips, that way image will move down
                    imgEnemy1.Top = imgEnemy1.Top + vMove
                End If
            Next delay
            hold = DoEvents
        Wend
    End If
    
Wend
End Sub