"use strict";
///////////////////////////////////////////////
//
//  Copyright 2016 David Gross
//  Not for distribution of modification of any kind without explicit written permission!
//
//  This is used to annoy the hell out of the player with popups.
//


function rand_array(ar){
	return ar[Math.floor(Math.random() * ar.length)];
}
var      fifdtxt = ["UUNG -- LOOKS SO GOOD!", "WANT", "YUM", "PUT IT IN MAH BELLI!", "LOOKS PERFECT GIMME"];
var     fruittxt = ["UGH!!  GROSS!", "CHEESE ON THAT BAD", "STAHP!"];
var     seventxt = ["3MUCH5ME", "DONT OVER DO IT", "THAT TOO MUCH", "WHAT HAPPEN?"];
var     scoretxt = ["YOU DOIN' GOOD!", "YEA LIKE THAT!", "KEEP IT UP!"];
var goodscoretxt = ["YOU KNOW WHAT YOU DOING.", "・・・FOR GREAT JUSTICE", "SOMEBODY SEND US UP THE SNACK."];

var   goodending = ["YOU MAKE US PROUD", "LOTS OF FOOD THANKU", "RLY GOOD JOB"];
var    badending = ["DO BETTR NEXT TIME", "CHEESE CHERRY YUCKS", "PLS TRY AGAIN"];

function badger(img, txt){
	this.life = 60 * 5; // 5 seconds
	this.image = grabimage(img);
	this.text = txt;
	this.lifetime = 0;
}



badger.prototype.tick = function(){
	this.lifetime += 1;
	return this.life-- <= 0;
}


badger.prototype.render = function(){
	
	var y = Math.pow(Math.min(1.0, Math.min(this.lifetime, this.life) / 60), 0.8) * 1.15 - .15;
	
	var cx = canvas.width;
	var cy = canvas.height;
	
	context.drawImage(this.image, 0, cy - this.image.height * y);
	
	context.font = "40px Comic Sans MS";
	context.fillStyle = "#444444"
	context.fillText(this.text, 41, cy - this.image.height * y - 39);
	context.fillStyle = "#ffffff"
	context.fillText(this.text, 40, cy - this.image.height * y - 40);

}