I saw a lot of topics by this problem but I couldn't find the right one. I'm trying to create hangman game and this is my code of letters component. I can't see my problems..
import Ember from 'ember';
export default Ember.Component.extend({
game: null,
letter: null,
isMissed: false,
isGuessed: false,
init() {
this._super.apply(this, arguments);
var game = this.get('game');
game.on('didGuessLetter', (l) => {
if (l === this.get('letter')) {
this.set('isGuessed', true);
}
});
game.on('didMissLetter', (l) => {
if (l === this.get('letter')) {
this.set('isMissed', true);
}
});
game.on('didReset', this, this.reset);
},
reset() {
this.set('isMissed', false);
this.set('isGuessed', false);
},
click() {
if (!(this.get('isMissed') || this.get('isGuessed'))) {
this.get('game').playLetter(this.get('letter'));
}
}
});
I couldn't find the bad place..
Aucun commentaire:
Enregistrer un commentaire