samedi 14 janvier 2017

How to Move the Pipes and Random it

Making a flappy bird clone. I don't know if these is the right code for pipes movement. Here's my code. Any code on how to move the pipes? And my problem is, how can I random the pipes? How would I do that? Thanks!

Where P1, P2, P3, P4, P5, P6 are picturebox (pipes).

Private Sub ObsM_Tick(sender As Object, e As EventArgs) Handles ObsM.Tick 'pipe movemen P1.Left = P1.Left - pspeed P2.Left = P2.Left - pspeed If P1.Left < 0 And P2.Left < 0 Then P1.Left = P1.Left + 600 P2.Left = P2.Left + 600 End If

    P3.Left = P3.Left - pspeed
    P4.Left = P4.Left - pspeed
    If P3.Left < 0 And P4.Left < 0 Then
        P3.Left = P3.Left + 600
        P4.Left = P4.Left + 600
    End If

    P5.Left = P5.Left - pspeed
    P6.Left = P6.Left - pspeed
    If P5.Left < 0 And P6.Left < 0 Then
        P5.Left = P5.Left + 600
        P6.Left = P6.Left + 600
    End If
End Sub

Aucun commentaire:

Enregistrer un commentaire