Start New Discussion within our Software Development Community

hi guys once again i need some help with creating a loop in my game's animation so that when the stop button is pressed the set of blocks stop while a new row appears above them and repeats the animation.

here's the code i have so far:

Dim Block(2) As BlockPart

Private Sub Form_Load()
    Dim i As Long
    length = 3
    For i = 0 To 2
        Block(i).X = (92 - 33 * i)
        Block(i).Y = 411
        ImgBlock(i).Left = Block(i).X
        ImgBlock(i).Top = Block(i).Y
        Block(i).Facing = 3
    Next i
End Sub

Private Sub TmrLeft_Timer()
    Dim i As Integer
    For i = 0 To 2
        ImgBlock(i).Left = ImgBlock(i).Left - 33
    Next i
    If ImgBlock(0).Left + ImgBlock(0).Width < ImgBackground.Left + 132 Then
        TmrLeft.Enabled = False
        TmrRight.Enabled = True
    End If
End Sub

Private Sub TmrRight_Timer()
    Dim i As Integer 'counter
    For i = 0 To 2 'for each frame
        ImgBlock(i).Left = ImgBlock(i).Left + 33
    Next i
    If ImgBlock(0).Left + ImgBlock(0).Width > ImgBackground.Width Then 'if at edge of screen
        TmrRight.Enabled = False 'stop timer
        TmrLeft.Enabled = True
    End If
End Sub

Private Sub CmdGo_Click()
    TmrRight.Enabled = True 'enable the timer
    CmdStop.Visible = True
End Sub

Private Sub CmdStop_Click()
    TmrRight.Enabled = False
    TmrLeft.Enabled = False
End Sub

Perhaps a boolean array with elements that equal your animation array elements that you can check against for specific element pauses/freezes. Just a thought...

Good Luck

This article has been dead for over six months. Start a new discussion instead.