VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Frogger

by waylon (1 Submission)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 5th March 2006
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Frogger

Rate Frogger




Dim lives As Integer
Dim score As Integer

Private Sub deadfrogimage_Timer()

    picfrog.Picture = LoadPicture("h:\frog1.bmp")
        lblscore.Caption = score
                picfrog.Top = 5400
                picfrog.Left = 2640
                picfrog.Left = picfield.Width / 2
    deadfrogimage.Enabled = False
   
End Sub

Private Sub Form_Load()

    picfrog.Top = 5400
    picfrog.Left = 2640
        lives = 30
            lbllives.Caption = lives
        score = 0
            lblscore.Caption = score
        

End Sub



Private Sub cmdquit_Click()
    Unload Me
End Sub

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Label1.Caption = KeyCode
    If KeyCode = 38 Then    'up
        picfrog.Top = picfrog.Top - 600 / 2
            If picfrog.Top >= piclily.Top And picfrog.Top <= piclily.Top Then
                If picfrog.Left >= piclily.Left And picfrog.Left <= piclily.Left Then
                score = score + 5
                    lblscore.Caption = score
                lives = lives + 1
                    lbllives.Caption = lives
                picfrog.Top = 5400
                picfrog.Left = 2640
                piclily.Picture = picfroglily
                End If
            End If
            ElseIf piclily.Picture = picfroglily Then
                picfrog.Top = 5400
                picfrog.Left = 2640
                score = score - 5
                lives = lives - 1
            End If
    If KeyCode = 40 Then    'down
        picfrog.Top = picfrog.Top + 600
        If picfrog.Top >= 6000 Then picfrog.Top = 5400
    End If
    If KeyCode = 37 Then    'left
        picfrog.Left = picfrog.Left - picfrog.Width / 2
    End If
    If KeyCode = 39 Then    'right
        picfrog.Left = picfrog.Left + picfrog.Width / 2
    End If

End Sub














Private Sub Timer1_Timer()
    
    'move car
    piccop.Left = piccop.Left + piccop.Width / 2
    If piccop.Left >= picfield.Width Then
        piccop.Left = -piccop.Left
    End If
    'move log
    Call imagechange
    
    If picfrog.Top = piclog.Top Then
        If picfrog.Left >= piclog.Left And picfrog.Left + picfrog.Width <= piclog.Left + piclog.Width Then
            picfrog.Left = picfrog.Left + piclog.Width / 7
        Else
            deadfrog
        End If
    End If
    piclog.Left = piclog.Left + piclog.Width / 7
    If piclog.Left >= picfield.Width Then
        piclog.Left = -piclog.Left
    End If


  
        piclog4.Left = piclog4.Left - piclog4.Width / 7
    If piclog4.Left <= -piclog4.Width Then
        piclog4.Left = picfield.Width
    End If
    
        If picfrog.Top = piclog4.Top Then
        If picfrog.Left >= piclog4.Left And picfrog.Left + picfrog.Width <= piclog4.Left + piclog4.Width Then
            picfrog.Left = picfrog.Left - piclog4.Width / 7
        Else
            deadfrog
        End If
    End If
    
     'MOVE BIKE
        picbike.Left = picbike.Left - picbike.Width / 9
    If picbike.Left <= -picbike.Width Then
        picbike.Left = picfield.Width
    End If
    
    If piccop.Top = picfrog.Top Then
        If picfrog.Left >= piccop.Left And picfrog.Left <= piccop.Left + piccop.Width Then
            Call deadfrog
        End If
    End If
    If picbike.Top = picfrog.Top Then
        If picfrog.Left >= picbike.Left And picfrog.Left <= picbike.Left + piccop.Width Then
            Call deadfrog
        End If
    End If
End Sub

Private Sub deadfrog()
    
 
    lives = lives - 1
        lbllives.Caption = lives
    score = score - 1
   picfrog.Picture = picblood
   deadfrogimage.Enabled = True

    If lives = 0 Then
        MsgBox "GAME OVER"
        Unload Me
    End If
End Sub


Private Sub imagechange()

    If picfrog.Top < 1560 Then
        picfrog.Picture = LoadPicture("h:\froglog.bmp")
    ElseIf picfrog.Top > 600 Then
        picfrog.Picture = LoadPicture("h:\frog1.bmp")
    End If
    
    If picfrog.Top > 4800 Then
        picfrog.Picture = LoadPicture("h:\froggrass.bmp")
    End If
    If picfrog.Top < 4800 And picfrog.Top > 3600 Then
        'picfrog.Picture = ("h:\frog1road.bmp")
    End If
        
End Sub


Download this snippet    Add to My Saved Code

Frogger Comments

No comments have been posted about Frogger. Why not be the first to post a comment about Frogger.

Post your comment

Subject:
Message:
0/1000 characters