Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


My Frogger Game


My Frogger Game

Author
Message
DevinM
DevinM
Forum God
Forum God (5.3K reputation)Forum God (5.3K reputation)Forum God (5.3K reputation)Forum God (5.3K reputation)Forum God (5.3K reputation)Forum God (5.3K reputation)Forum God (5.3K reputation)Forum God (5.3K reputation)Forum God (5.3K reputation)

Group: Forum Members
Posts: 39, Visits: 85
' This is my first real game and I decided that the best thing to do would
' be frogger but There is two things that are making it hard
' I have used adobe photoshop to make my characters but the parts of the
' pictures that are supposed to be transparent ( I think it might be because
' I used a bitmap but the other is my speed of the cars, please help.
' I haven't made the collision detection yet though.

Option Explicit
Dim level As Integer
Public x As Integer
Dim win As Boolean
Dim speed(1 To 4) As Integer
Dim car As Integer
Dim lives As Integer

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
        Case vbKeyLeft
            shpman.Left = shpman.Left - 200
        Case vbKeyRight
            shpman.Left = shpman.Left + 200
        Case vbKeyUp
            shpman.Top = shpman.Top - 490
        Case vbKeyDown
            shpman.Top = shpman.Top + 490
    End Select
   
    If shpman.Top < 255 Then
        MsgBox "You win!"
        shpman.Top = 2650
        shpman.Left = 2040
        win = True
    Else
        win = False
    End If
   
    If win = True Then
        For x = 1 To 4
            speed(x) = Int((level * 2) * 15 * Rnd)
        Next x
    End If
   
End Sub

Private Sub form_load()
    frminfo.Show
    tmrcommove.Enabled = True
    frmgame.Hide

    tmrcommove.Interval = 4

    
    For x = 1 To 4
            speed(x) = Int((level * 2) * 15 * Rnd)
    Next x
End Sub

Private Sub tmrcommove_Timer() ' when this timer goes of it make the cars move
    tmrcommove.Interval = 4
   
    For x = 1 To 2
        shpcar(x).Left = shpcar(x).Left - speed(1) ' these are the cars going left
    Next x
   
    For x = 3 To 4
        shpcar(x).Left = shpcar(x).Left - speed(2) ' these are other cars going left
    Next x                                                                       ' but at different speed
    
    For x = 1 To 4
        shpcar(x).Left = shpcar(x).Left + speed(3) ' cars going right as different speed
    Next x
   
    For x = 7 To 8
        shpcar(x).Left = shpcar(x).Left + speed(2)' cars going right different speed
    Next x
End Sub

' something isn't letting the cars move, they just stay in the same place and flash

' repeatedly so I am really stumped

Junaid
Junaid
Supreme Being
Supreme Being (265 reputation)Supreme Being (265 reputation)Supreme Being (265 reputation)Supreme Being (265 reputation)Supreme Being (265 reputation)Supreme Being (265 reputation)Supreme Being (265 reputation)Supreme Being (265 reputation)Supreme Being (265 reputation)

Group: Forum Members
Posts: 1, Visits: 3
if you can post your source in here then maybe i will be able to help you in it..
GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search