7 Replies Latest reply on Aug 20, 2010 4:53 PM by Spaghetee

    Bonus points through a collision

    Spaghetee

      I have a score system on one of my games, and it involves a dynamic textbox with a bonus system. I want to make it so that when my main character and special objects collide, bonus score is added.

       

      This is my code for my scorelayer, instance name of scorebox is (score_txt)

       

      var score : Number = 0
      function addScore () {
          score++;
          score_txt.text=score
      }

       

      var scoreInteral=setInterval(addScore,.1)

       

      --

       

      There was a bonus code for it but I removed it because I couldn't get it to work with collisions. All enemies/powerups spawn in the middle of the game so they don't have instance names (so I can't do a hittest between my main character (instance name: Thedude) and any enemies (No instance name) )

       

      I can do collision test by putting codes in the spawning thing's .as file, that way I can make a collision code without having both parties needing an instance name, but I have no bonus score code to work with. The one I used on my score layer does not work if put in a character's .as file.

       

      HELP please!

       

      Thanks

      -Spaghetee