Alright, I'm trying to make a Breakout game, I have the ball moving and such, but I'm not sure of how to check if the ball has touched the brick, and if so, bounce it again and make that brick invisible.
Get it? Got it? Good.
now, I have this....
VB Code:
Public Sub BlockSub(Ball As Shape, brick As Shape) If Ball.Top - Ball.Height = brick.Top And Ball.Top = brick.Top - brick.Height Then YSpeed = -YSpeed Ball.Top = Ball.Top + YSpeed Paddle.Visible = False End If If Ball.Top = brick.Top + brick.Height Then YSpeed = -YSpeed Ball.Top = Ball.Top + YSpeed Paddle.Visible = False End If 'If Ball.Top + Ball.Height < Paddle.Top And Ball.Left >= Paddle.Left Then ' YSpeed = -YSpeed ' Ball.Top = Ball.Top + YSpeed 'Paddle.Visible = False 'End If If Ball.Left + Ball.Width = brick.Left Then XSpeed = -XSpeed Ball.Left = Ball.Left + XSpeed Paddle.Visible = False End If If Ball.Left = brick.Left + brick.Width Then XSpeed = -XSpeed Ball.Left = Ball.Left + XSpeed Paddle.Visible = False End If End Sub
Any suggestions?




Reply With Quote