dcsimg
A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: Keeping score with hitTest

  1. #1
    Senior Member
    Join Date
    Aug 2000
    Posts
    309

    Keeping score with hitTest

    Hey Flashers

    I'm trying to keep score of the hits in my game but I'm not having much luck. I tried using hitTest to send a value to 'score' when an object is hit on the stage, but I can't get it to register.Can anyone help me with the code where 'ship' is the object on the stage that collides with 'hit' sending the value to text field 'score'?

    cheers

    yeffeKr
    [swf width="300" height="40" background="#000000"]http://www.badeyes.com/banner.swf[/swf]

  2. #2
    something like this may work (bear with me. its been a while since i have done anything like this).

    onClipEvent (enterFrame) {
    if (this.hitTest(_parent.hit) == true) {
    _parent.score+=1;
    }
    }

    with this you will want to have the dynamic text block that is populating with the score variable update on enterframe as well.

    i hope this at least gets you moving in the right direction.

  3. #3
    Senior Member
    Join Date
    Aug 2000
    Posts
    309
    Thanks JoshuaT

    I was putting the code in the wrong place, I ended up putting score=+ 10 to add 10 points each time. Thanks for your help, I'm sure it would ahve worked.

    yeffer
    [swf width="300" height="40" background="#000000"]http://www.badeyes.com/banner.swf[/swf]

  4. #4

  5. #5
    Senior Member
    Join Date
    Aug 2000
    Posts
    309
    Thanks for the link. It's a bit difficult to read as I use JAWS(screen reader) and he's not reading it to well. ;O( I'll see if I can fiugre my wasy around it.

    yeffer
    [swf width="300" height="40" background="#000000"]http://www.badeyes.com/banner.swf[/swf]

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