A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: MX 2004 hittest trouble

  1. #1
    Senior Member
    Join Date
    Jan 2001
    Posts
    126

    MX 2004 hittest trouble

    Hi everyone,

    Hope you can help me out again:

    Im trying to get the hittest to work in flash mx 2004 but i get stuck.

    i have 2 movieclips: ball and triangles

    the movieclip triangles has 2 triangles inside of it
    those 2 triangles stand a little bit apart so there is an empty space between the shapes.

    What i try to do is that when the ball hits one of the triangles
    it adds 1 point to score..

    it works but the hittest reacts on the whole clip and not on the shape of the 2 triangles ?!?!

    can i set the hittest so that it only counts 1 point if it really touches the shape ?!

    this is the code i have so far but then it reacts on the whole triangles movie clip and not on the shapes inside of it

    Code:
    ball.onEnterFrame = function () {
      if (this.hitTest(_root.triangles)){
    	  _root.score +=1 ;
      }
    }
    I thought i simple:
    Code:
    if (this.hitTest(_root.triangles))
    would work but thats not the case, i also tried to read through the actionscript dictionary but that doesn't make much sense to me

    another problem is that when ball hits the triangle and it is to long on the clip the hittest keeps counting so score goes like 1,2,3,4,5 instead of only adding one point

    hope someone can help me

    thanx in advange,

    Assenoost

  2. #2
    Senior Member
    Join Date
    Jan 2001
    Posts
    126
    No one out there that has the answer ?


    Assenoost

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