Results 1 to 3 of 3

Thread: Brick Collision Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2002
    Posts
    3

    Brick Collision Help

    I have a code but it keeps saying not defined for the "i". here it is:


    Private Sub Timer1_Timer()
    shpBall.Left = Ball.X + (Ball.radius)
    shpBall.Top = Ball.Y + (Ball.radius)
    Ball.X = Ball.X + Ball.a
    Ball.Y = Ball.Y + Ball.b

    Call FormBrickCollisionDetection
    Call FormCollisionDetection
    End Sub

    Private Sub FormBrickCollisionDetection()
    For i = 0 To 179
    If Ball.Y + Ball.diameter = Brick(Index).Top + Brick(Index).Height Then
    Ball.b = -Abs(Ball.b)
    Brick(Index).Visible = False
    End If
    Next i

    End Sub

  2. #2
    Addicted Member Peter1's Avatar
    Join Date
    Aug 2002
    Posts
    166
    If you've got Option Explicit on you may need to dimension 'i'.

    For your collision detection have a look into using IntersectRect instead, might be easier.

    Pete

  3. #3
    Not NoteMe SLH's Avatar
    Join Date
    Mar 2002
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width