
// 1 animal, 3 words

AnimalsGame.LevelType4 = new Class(AnimalsGame.Level, {
	
	initialize: function(opts) {
		this.$super(opts);
		
		this.rightAnimals = this.animals.clone().shuffle();
		this.wrongAnimals = this.animals.clone().shuffle();
		
		this.createQuestion();
	},
	
	createQuestion: function(opts) {
		var this_ = this;
		
		this_.$super(opts);
		
		// reset the list of wrong answers if we asked each of them once
		if ( this.wrongAnimals.length <= 2 ) {
			this.wrongAnimals = this.animals.clone().shuffle();
		}
		
		// exclude right answer from possible list of wrong answers
		this.wrongAnimals = this.wrongAnimals.reject(function(a) { return a.english == this_.rightAnswer.english }).shuffle();
		
		this.wrongAnswers = [
			this.wrongAnimals.shift(),
			this.wrongAnimals.shift()
		];
		
		var actorPositions = ([
			
			{ left: '66%', top:  '9%' },
			{ left: '66%', top: '35%' },
			{ left: '66%', top: '61%' }
			
		]).shuffle();
		
		this.questionStageElements = [
		
			// question : animal picture
			new AnimalsGame.Actor({
				filename: this.rightAnswer.image,
				position: { left: '23%', top: '31%' },
				interactive: false
			}),
			
			// right answer text
			new AnimalsGame.Actor({
				position: actorPositions.shift(),
				filename: 'section-' + this.section.sectionName + '-small-circle',
				filenameHover: 'section-' + this.section.sectionName + '-small-circle-hover',
				path: 'assets/images/circles',
				className: 'small-circle',
				click: function() {
					this_.triggerRightAnswer();
				},
				children: [
					new AnimalsGame.StageElement({
						element:  $E('h1').addClass('interactive').html( this.rightAnswer.hudson )._,
						autoAppend: false,
						interactive: false,
						className: 'question-type-3-answer-text' + this.computeTextSize(this.rightAnswer.hudson)
					})
				]
			}),
			
			// wrong answers texts
			new AnimalsGame.Actor({
				position: actorPositions.shift(),
				filename: 'section-' + this.section.sectionName + '-small-circle',
				filenameHover: 'section-' + this.section.sectionName + '-small-circle-hover',
				path: 'assets/images/circles',
				className: 'small-circle',
				click: function() {
					this_.triggerWrongAnswer();
				},
				children: [
					new AnimalsGame.StageElement({
						element:  $E('h1').addClass('interactive').html( this.wrongAnswers[0].hudson )._,
						autoAppend: false,
						interactive: false,
						className: 'question-type-3-answer-text' + this.computeTextSize(this.wrongAnswers[0].hudson)
					})
				]
			}),
			new AnimalsGame.Actor({
				position: actorPositions.shift(),
				filename: 'section-' + this.section.sectionName + '-small-circle',
				filenameHover: 'section-' + this.section.sectionName + '-small-circle-hover',
				path: 'assets/images/circles',
				className: 'small-circle',
				click: function() {
					this_.triggerWrongAnswer();
				},
				children: [
					new AnimalsGame.StageElement({
						element:  $E('h1').addClass('interactive').html( this.wrongAnswers[1].hudson )._,
						autoAppend: false,
						interactive: false,
						className: 'question-type-3-answer-text' + this.computeTextSize(this.wrongAnswers[1].hudson)
					})
				]
			})
		];
		
		this.questionStageElements.each(function(el) { $(el.element).hide() });
		this.createTimer();
	}
});
