ExtraLudic / Daedalus_Tamagotchi

0 stars 0 forks source link

Egg hatching issues #60

Open anikaolivo opened 6 years ago

anikaolivo commented 6 years ago

I get it up to 75%, it gives me the "I've hatched" message but nothing happens. Should be hatching at 80% but sending another sun emoji does nothing

screen shot 2018-03-29 at 3 53 47 pm
anikaolivo commented 6 years ago

Chick also hatches but doesn't show up

esalling23 commented 6 years ago

@barrettand this was due to the code stuck in a while loop that was added to have non-duplicate button emojis

starting at line 76 in board_setup.js we had this before:

var definitelyNewEmoji = false;
var emoji = randomEmoji.random({count: 1})[0].character;

while(!definitelyNewEmoji) {
   _.each(btn_emojis, function(e) {
      definitelyNewEmoji = (emoji != e);
   });
}   
btn_emojis.push({ emoji: emoji, value: btn.value });
btn.text = emoji;

which has been changed to this:

var definitelyNewEmoji = false;
var emoji = randomEmoji.random({count: 1})[0].character;

while(!definitelyNewEmoji) {
   if (btn_emojis.length > 0) {
      _.each(btn_emojis, function(e) {
         definitelyNewEmoji = (emoji != e);
      });
   } else 
        definitelyNewEmoji = true;
}

btn_emojis.push({ emoji: emoji, value: btn.value });
btn.text = emoji;

because unless the user already has a set of saved buttons, btn_emojis is an empty array. This meant that definitelyNewEmoji was never being set to true at the start of a new tamagotchi