All pastes #64668 Raw Edit

Miscellany

public text v1 · immutable
#64668 ·published 2006-06-12 03:05 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
      
        For DelayLaser = 1 To 100000000
            imgLaser1.Top = imgLaser1.Top - 5
            hold = DoEvents
        Next DelayLaser
        

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 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 + 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
                '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
                End If
                'Add height in twips, that way image will move down( leave this outside the if statement, as it gets executed either way...not a bug, just something im fixing)
                imgEnemy1.Top = imgEnemy1.Top + vMove
                hold = DoEvents

Wend
End Sub