Dim g As Graphics Dim gb As Graphics Dim bitmap As Image Dim flag As Boolean = True Dim x = 450, y = 0 Dim dx = 0, dy = 100 Dim olddx, olddy As Integer Dim maru As New Bitmap("maru.gif") 'ボウル(影が右から左にある) Dim maru2 As New Bitmap("maru2.gif") 'ボウル(影が左から右にある) Dim netto As New bitmap("netto.gif") 'ネット Dim n1, n2, n3, n4, n5, n6 As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click g = PictureBox1.CreateGraphics gb = PictureBox1.CreateGraphics gb.DrawImage(netto, x, y, netto.Width, 450) Timer1.Enabled = True Timer2.Enabled = False Timer3.Enabled = False Timer4.Enabled = False Timer5.Enabled = False Randomize() n1 = Int(Rnd() * 3) If n1 = 0 Then Timer6.Interval = 30 ElseIf n1 = 1 Then Timer1.Interval = 80 ElseIf n1 = 2 Then Timer1.Interval = 40 End If End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick g.FillRectangle(Brushes.White, olddx, olddy, maru.Width, maru.Height) g.FillRectangle(Brushes.White, olddx, olddy, maru2.Width, maru2.Height) gb = PictureBox1.CreateGraphics gb.DrawImage(netto, x, y, netto.Width, 450) olddx = dx olddy = dy If dx < 600 Then dx = dx + 15 dy = dy Else dx = dx + 10 dy = dy + 10 End If If dy > 350 Then Timer1.Enabled = False SoundFileName = """kk.wav""" mciSendString("Play " & SoundFileName, vbNull, 0, 0) 'BGMを鳴らす 'BGMが鳴ったら得点 End If flag = Not flag 'ボールを回転させる If flag = True Then Dim destRect As New Rectangle(dx, dy, maru.Width, maru.Height) Dim srcRect As New Rectangle(0, 0, maru.Width, maru.Height) g.DrawImage(maru, destRect, srcRect, GraphicsUnit.Pixel) Else Dim destRect As New Rectangle(dx, dy, maru2.Width, maru2.Height) Dim srcRect As New Rectangle(0, 0, maru2.Width, maru2.Height) g.DrawImage(maru2, destRect, srcRect, GraphicsUnit.Pixel) End If End Sub