A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Hittest Question

  1. #1
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874

    Hittest Question

    Just having a play around with some hittest methods i thought of. Just need a few answers.

    Can you set more than just 1 x and y coordinate in the hittest.
    EG: if (b1.hitTest(b2._x-b2._width/2, b2._y +15 , b2_y - 15, true)) {

    To me that seem it would check to see if b1 hits b2's left edge at b2._y - and + 15. Didnt work for me, do i have to rite up 2 seperate hittests for each point?.
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  2. #2
    Senior Member Gloo pot's Avatar
    Join Date
    Aug 2005
    Location
    Australia Mate!
    Posts
    874
    I had a couple more goes and tryed to get it to work and i got it, i just added "or" and then repeted the hittest with a different coordinate and it works like a charm.

    Thanks and way

    -EDIT-

    I have another question, does having function in function in function bad?
    I have a seperate function to check each side for collision, i then have another function which finds out what direction the objects traverling and declairs when and when not to check for collision (So i have the collision functions in this function), I then have that function in the main function that runs the game.

    Any advice?
    Last edited by Gloo pot; 05-21-2006 at 07:15 AM.
    92.7 Fresh FM for all your South Aussies - Doof Doof music FTW people!

  3. #3
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    Nested functions are okay. It's a perfectly natural thing, everyone does it.
    http://www.birchlabs.co.uk/
    You know you want to.

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

HTML5 Development Center