
// 1 word, 2 animals

AnimalsGame.LevelType1 = 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 <= 1 ) {
			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()
		];
		
		var actorPositions = ([
			
			{ left: '29%', top: '36%' },
			{ left: '56%', top: '36%' }
			
		]).shuffle();
		
		var elem = document.createElement('h1');
		elem.className = 'animal-name';
		elem.innerHTML = '<span>'+ this.rightAnswer.hudson +'</span>';
		
		this.questionStageElements = [
		
			// right answer actor
			new AnimalsGame.Actor({
				position: actorPositions.shift(),
				filename: 'section-' + this.section.sectionName + '-big-circle',
				filenameHover: 'section-' + this.section.sectionName + '-big-circle-hover',
				path: 'assets/images/circles',
				className: 'big-circle',
				click: function() {
					this_.triggerRightAnswer();
				},
				children: [
					new AnimalsGame.Actor({
						filename: this.rightAnswer.image,
						autoAppend: false,
						interactive: false
					})
				]
			}),
			
			// wrong answers actors
			new AnimalsGame.Actor({
				position: actorPositions.shift(),
				filename: 'section-' + this.section.sectionName + '-big-circle',
				filenameHover: 'section-' + this.section.sectionName + '-big-circle-hover',
				path: 'assets/images/circles',
				className: 'big-circle',
				click: function() {
					this_.triggerWrongAnswer();
				},
				children: [
					new AnimalsGame.Actor({
						filename: this.wrongAnswers[0].image,
						autoAppend: false,
						interactive: false
					})
				]
			}),
			
			// question : animal name
			new AnimalsGame.StageElement({
				element:  elem,
				interactive: false
			})
		];
		
		this.questionStageElements.each(function(el) { $(el.element).hide() });
		this.createTimer();
	}
});
