

書いたコードとシートの画像です

[code]

    Dim vx, vy, dt, x, y As Single
    Dim k, n, v As Integer
    Dim b_px(100), b_py(100), b_vx(100), b_vy(100) As Single
    Dim losted() As Single
    
    Sub ball()
        dt = Cells(2, 5)
        vx = Cells(5, 2)
        vy = Cells(5, 3)
        x = Cells(2, 2).Value
        y = Cells(2, 3).Value
        v = 0
    
    Do
        Calculate
            x = x + vx * dt
            y = y + vy * dt
        For k = 1 To 2
            Cells(3, 2) = x
            Cells(3, 3) = y
            DoEvents
        Next k
        DoEvents
        Call wallball
            If Cells(3, 3) <= 0.28 Then
                MsgBox "GameOver"
                Exit Do
            Else
        End If
        Call breakball
    Loop
    
    For I = 0 To v - 1
    
        If losted(I) >= 8 Then
            Cells(10 + losted(I), 2) = losted(I) + 1
            Cells(10 + losted(I), 3) = 9
        Else
            Cells(10 + losted(I), 2) = losted(I) - 8
            Cells(10 + losted(I), 3) = 8
        End If
    Next I
    End Sub
    
    Sub wallball()
        Select Case Cells(3, 2).Value
            Case Is >= 9.72
                vx = -1 * vx
            Case Is <= 0.28
                vx = -1 * vx
        End Select
        Select Case Cells(3, 3).Value
            Case Is >= 9.72
                vy = -1 * vy
        End Select
    End Sub
    
    Sub breakball()
        For n = 0 To 17
                b_px(n) = Cells(10 + n, 2)
                b_py(n) = Cells(10 + n, 3)
            If y > b_py(n) - 0.55 And y < b_py(n) + 0.55 Then
                    If x < b_px(n) + 0.6 And x > b_px(n) - 0.6 Then
                            vx = -1 * vx
                            Cells(10 + n, 2) = 0
                            Cells(10 + n, 3) = -1
                            ReDim losted(v)
                            losted(v) = n
                            v = v + 1
                            Cells(8, 2) = v
                            DoEvents
                        Else
                    End If
                Else
            End If
        
            If x > b_px(n) - 0.55 And x < b_px(n) + 0.55 Then
                    If y < b_py(n) + 0.6 And y > b_py(n) - 0.6 Then
                            vy = -1 * vy
                            Cells(10 + n, 2) = 0
                            Cells(10 + n, 3) = -1
                             ReDim losted(v)
                            losted(v) = n
                            v = v + 1
                            Cells(8, 2) = v
                            DoEvents
                        Else
                    End If
                Else
            End If
        Next n
    End Sub
    
[/code]

[![](https://i.stack.imgur.com/UvUNH.png)](https://i.stack.imgur.com/UvUNH.png)


CC BY-SA 4.0
2023-11-28T06:15:30.877
96927
2023-11-28T06:22:31.340
2023-11-28T06:22:31.340
3060
60557
question
vba excel
ブロック崩しゲームの制作を試みたのですが、オーバーフローのエラーが出ました。なぜですか？