Help with "falling objects" game

brain

New member
Joined
Oct 29, 2008
Messages
1
Programming Experience
Beginner
not sure if this is in the right place but..

Hey guys, im trying to code a dodge the falling objects type game. And i was just wondering if you could help me, cos im a little stuck now lol.

heres what ive got so far ( it know its probably a mess)
VB.NET:
Public Class Form1
    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown

        Dim pikaX As String
        Dim PikaY As String


        pikaX = imgpika.Location.X
        PikaY = imgpika.Location.Y


        Select Case e.KeyCode
            Case Keys.Right
                imgpika.Image = My.Resources.pikaR

                If imgpika.Right < Me.Width - 10 Then
                    imgpika.Location = New Point(pikaX.ToString + 5, PikaY.ToString)

                End If

            Case Keys.Left

                imgpika.Image = My.Resources.pikaL
                If imgpika.Left > 0 Then
                    imgpika.Location = New Point(pikaX.ToString - 5, PikaY.ToString)
                End If

            Case Keys.Enter

                Dim e1X As String
                Dim e1Y As String
                Dim Fall As Boolean
                Fall = True

                Do
                    e1X = imgE1.Location.X
                    e1Y = imgE1.Location.Y

                    If imgE1.Bottom > Me.Height - 30 Then
                        e1Y = imgE1.Location.Y - Me.Height
                        e1X = Rnd() * (Me.Width - imgE1.Width)
                    End If

                    imgE1.Location = New Point(e1X.ToString, e1Y.ToString)

                    imgE1.Location = (New Point(imgE1.Location.X, imgE1.Location.Y + 5))

                Loop While Fall = True
                imgE1.Refresh()
        End Select
    End Sub

End Class
One of the problems im having is i cant move the character while the object is falling.

The falling of the object causes the form to crash

ive only been coding in VB.net for just over a month and any help you guys can give will be appreciated :)
 
Back
Top