help with scoring please

  • bohemyth
  • Born
  • Born
  • bohemyth
  • Posts: 1

Post 3+ Months Ago

this.onEnterFrame = function() {
moveBullets();
for(var i = 0;i<bulletArray.length; i++){
if(bulletArray[i].hitTest(enemy_mc1)) {
_root.enemy_mc1._visible=false;

_root.scoretxt = 1;
}
if(bulletArray[i].hitTest(enemy_mc2)) {
_root.enemy_mc2._visible=false;

_root.scoretxt = 1;
}
if(bulletArray[i].hitTest(enemy_mc3)) {
_root.enemy_mc3._visible=false;

_root.scoretxt = 1;
}

}

That's my code: There a 3 enemies and when each one gets shot I want the score to add 1 per enemy. At the moment, if u shoot any one of them the first one that gets hit add 1 to the score but not for the others. Can anyone help?
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • krismeister
  • Graduate
  • Graduate
  • krismeister
  • Posts: 202

Post 3+ Months Ago

_root.scoretxt +=1

note that the correct variable type for scoretxt is Number not String. Your nomenclature is a little confusing, maybe it should be scoreNUM or num_score or whatever.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 18 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.