PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
colliding graphics-VBForums
Results 1 to 4 of 4

Thread: colliding graphics

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2007
    Posts
    66

    colliding graphics

    vb Code:
    1. If Ball.VisibleClipBounds.Bottom = Bar.VisibleClipBounds.Top Then
    2.             tracker = 500
    3.             tracker2 = 500
    4.         End If


    shouldn't this take care of two objects colliding?? when they DO collide, nothing happens, they go right through each other. there are alot of good method for visible clip bounds, and i have tried alot of them, suggestions would be nice.
    Last edited by kylekocak; Apr 26th, 2007 at 01:41 PM.

  2. #2
    Lively Member
    Join Date
    Jul 2002
    Posts
    86

    Re: colliding graphics

    Instead of checking if the bottom clip bound is EQUAL to the top of the bar, check if its GREATER THAN OR EQUAL to the top of the bar (or less than, I keep forgetting where VB starts the 0 y value). The chances that the ball is exactly equal to the top of the bar is very very small, you have to check if its greater than or equal.

    Try that and if it doesn't work, please post more of the code.

  3. #3
    Junior Member
    Join Date
    Mar 2007
    Location
    New Jersey
    Posts
    30

    Re: colliding graphics

    Try
    if(Ball.VisibleClipBounds.Bottom >= Bar.VisibleClipBounds.Top) Then
    and then depending on how you do the game you might want to add another if to make sure that it is colliding below also:
    if(Ball.VisibleClipBounds.Top <= Bar.VisibleClipBounds.Bottom) Then
    Final Fantasy Tactics Online
    Blank Engine (3D, Opensource, VB Engine)(Under construction but does have a download)

  4. #4
    Hyperactive Member singularis's Avatar
    Join Date
    Nov 2006
    Location
    Over There!
    Posts
    372

    Re: colliding graphics

    @kylekocak: Basically you are checking to see if the shapes have the same Y coordinate so they miss each other when you move one quicker the a twip per second.

    What are "Tracker" and "Tracker2"? Are they shapes or varibles? if they are shapes why don't you set Tracker.top to 500 and Tracker2.top to 500?

    Can you also post some more code so that we can understand what you want to achieve.
    If what I said was helpful, give me rep!

    My Complete Games: -- 2D Zone (Space Shooter game) || _2D Zone 2_ || Ninja Blob (2D platformer) || Dren (Co-op up to 4 player base defence game)

    My Projects: -- The Dread Engine (2D VB game Engine) || A* Path Finding


    An excellent site for learning DirectX7, 8 & 9 (for VB6, C# & VB.net) would be: directx4vb.vbgamer.com --- For my projects and games see: pieper.freehostia.com

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width