图片框移动时如何让我的精灵动画?它也需要在每次经过一个角落时改变位置

How do I make my sprite animate while the picture box is moving? It also needs to change position every time it passes a corner

Public Class Form1
        Dim anm As Integer = 1

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        R1.Left = R1.Left + 5
        animate()
        If R1.Left >= 210 Then
            Dim w = R1.Width
            R1.Width = R1.Height
            R1.Height = w
            Timer1.Stop()
            Timer2.Start()
        End If
    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        R1.Top = R1.Top + 5
        animate()
        R1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
        R1.Refresh()
        If R1.Top >= 190 Then
            Dim w = R1.Width
            R1.Width = R1.Height
            R1.Height = w
            Timer2.Stop()
            Timer3.Start()
        End If
    End Sub
    Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
        R1.Left = R1.Left - 5
        animate()
        R1.Image.RotateFlip(RotateFlipType.Rotate180FlipNone)
        R1.Refresh()
        If R1.Top <= 0 Then
            Dim w = R1.Width
            R1.Width = R1.Height
            R1.Height = w
            Timer3.Stop()
            Timer4.Start()
        End If
    End Sub
    Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
        R1.Top = R1.Top - 2
        animate()
        R1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
        R1.Refresh()
        If R1.Top <= 0 Then
            Dim w = R1.Width
            R1.Width = R1.Height
            R1.Height = w
            Timer4.Stop()
            Timer1.Start()
        End If
    End Sub

    Private Sub animate()
        If anm = 1 Then
            R1.Image = Image.FromFile(Application.StartupPath & "_SONICRUN1-removebg-preview-removebg-preview.png")
            anm = 2
        ElseIf anm = 2 Then
            R1.Image = Image.FromFile(Application.StartupPath & "_SONICRUN2-removebg-preview-removebg-preview.png")
            anm = 3
        ElseIf anm = 3 Then
            R1.Image = Image.FromFile(Application.StartupPath & "_SONICRUN3-removebg-preview-removebg-preview.png")
            anm = 4
        ElseIf anm = 4 Then
            R1.Image = Image.FromFile(Application.StartupPath & "_SONICRUN4-removebg-preview-removebg-preview.png")
            anm = 1
        End If
    End Sub
End Class

请帮助我让它像

每次碰到角都要换位置,一开始是倒立的,碰到角的时候是朝下的。请确保一切正常,请您帮忙,我真的需要帮助。谢谢你们。我需要它在图片框循环移动时设置动画。

您可以尝试调换图片框的高度和宽度,然后旋转里面的图片,达到您想要的效果。

    Dim anm As Integer = 1

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    R1.Left = R1.Left + 2
    animate()
    If R1.Left >= 219 Then
        Dim w = R1.Width
        R1.Width = R1.Height
        R1.Height = w
        Timer1.Stop()
        Timer2.Start()
    End If
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
    R1.Top = R1.Top + 2
    animate()
    R1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone)
    R1.Refresh()
    If R1.Top >= 202 Then
        Dim w = R1.Width
        R1.Width = R1.Height
        R1.Height = w
        Timer2.Stop()
        Timer3.Start()
    End If
End Sub

Private Sub animate()
    If anm = 1 Then
        R1.Image = Image.FromFile("picture1")
        anm = 2
    ElseIf anm = 2 Then
        R1.Image = Image.FromFile("picture2")
        anm = 3
    ElseIf anm = 3 Then
        R1.Image = Image.FromFile("picture3")
        anm = 4
    ElseIf anm = 4 Then
        R1.Image = Image.FromFile("picture4")
        anm = 1
    End If
End Sub