<commit_before>//puts the enemy on  a timer
game.GameTimerManager = Object.extend({
init: function(x, y, settings){
this.now = new Date().getTime();
this.lastCreep = new Date().getTime();
this.paused = false;
this.alwaysUpdate = true;
},
update: function(){
	//keeps track of time
this.now = new Date().getTime();

this.goldTimerCheck();
this.creepTimerCheck();


	return true;
},
goldTimerCheck: function(){
	if(Math.round(this.now/1000)%20 ===0 && (this.now - this.lastCreep >= 1000)){
	game.data.gold += (game.data.exp1+1);
	console.log("Current gold:" + game.data.gold);
		}

	},
	creepTimerCheck: function(){
		if(Math.round(this.now/1000)%10 ===0 && (this.now - this.lastCreep >= 1000)){
	this.lastCreep = this.now;
	var creepe = me.pool.pull("EnemyCreep", 1000, 0, {});
	me.game.world.addChild(creepe, 5);
		}
	}
});

game.HeroDeathManager = Object.extend({
	init: function(x, y, settings){
		this.alwaysUpdate = true;
	},
	update: function(){
		if(game.data.player.dead){
	me.game.world.removeChild(game.data.player);
	//reseting the player
	me.state.current().resetPlayer(10, 0);
		}
		return true;
	}
});

game.ExperienceManager = Object.extend({
	init: function(x, y, settings){
		this.alwaysUpdate = true;
		game.gameover = false;

	},
	update: function(){
		if(game.data.win === true && !this.gameover){
			this.gameOver(true);
		}else if(game.data.win === false && !this.gameover){
			this.gameOver(false);
			
		}

		return true;
	},

	gameOver: function(win){
		if(win){
			game.data.exp += 10;
		}else{
			game.data.exp += 1;
		}
			
			game.gameover = true;
			me.save.exp = game.data.exp;
			
	}
});

	game.SpendGold = Object.extend({
	init: function(x, y, settings){
	this.now = new Date().getTime();
	this.lastBuy = new Date().getTime();
	this.paused = false;
	this.alwaysUpdate = true;
},
	update: function(){
		return true;
	}
});<commit_msg>video 47 Drawing spendGold image<commit_after>//puts the enemy on  a timer
game.GameTimerManager = Object.extend({
init: function(x, y, settings){
this.now = new Date().getTime();
this.lastCreep = new Date().getTime();
this.paused = false;
this.alwaysUpdate = true;
},
update: function(){
	//keeps track of time
this.now = new Date().getTime();

this.goldTimerCheck();
this.creepTimerCheck();


	return true;
},
goldTimerCheck: function(){
	if(Math.round(this.now/1000)%20 ===0 && (this.now - this.lastCreep >= 1000)){
	game.data.gold += (game.data.exp1+1);
	console.log("Current gold:" + game.data.gold);
		}

	},
	creepTimerCheck: function(){
		if(Math.round(this.now/1000)%10 ===0 && (this.now - this.lastCreep >= 1000)){
	this.lastCreep = this.now;
	var creepe = me.pool.pull("EnemyCreep", 1000, 0, {});
	me.game.world.addChild(creepe, 5);
		}
	}
});

game.HeroDeathManager = Object.extend({
	init: function(x, y, settings){
		this.alwaysUpdate = true;
	},
	update: function(){
		if(game.data.player.dead){
	me.game.world.removeChild(game.data.player);
	//reseting the player
	me.state.current().resetPlayer(10, 0);
		}
		return true;
	}
});

game.ExperienceManager = Object.extend({
	init: function(x, y, settings){
		this.alwaysUpdate = true;
		game.gameover = false;

	},
	update: function(){
		if(game.data.win === true && !this.gameover){
			this.gameOver(true);
		}else if(game.data.win === false && !this.gameover){
			this.gameOver(false);
			
		}

		return true;
	},

	gameOver: function(win){
		if(win){
			game.data.exp += 10;
		}else{
			game.data.exp += 1;
		}
			
			game.gameover = true;
			me.save.exp = game.data.exp;
			
	}
});

	game.SpendGold = Object.extend({
	init: function(x, y, settings){
	this.now = new Date().getTime();
	this.lastBuy = new Date().getTime();
	this.paused = false;
	this.alwaysUpdate = true;
	this.updateWhenPaused = true;
	this.buying = false;
},
	update: function(){
		this.now=new Date().getTime();
		if(me.input.isKeyPressed("buy") && this.now-this.lastBuy >=1000){
			this.lastBuy = this.now;
			if(!this.buying){
				this.startBuying();
			}else{
				this.stopBuying();
			}

		}
		return true;
	},
	startBuying: function(){
		this.buying = true;
		me.state.pause(me.state.PLAY);
		game.data.pausePos = me.game.viewport.localToWorld(0, 0);
	game.data.buyscreen = new me.Sprite(game.data.pausePos.x, game.data.pausePos.y, me.loader.getImage('gold-screen'));
	game.data.buyscreen.updateWhenPaused = true;
	game.data.buyscreen.setOpacity(0.8);
	me.game.world.addChild(game.data.buyscreen, 34);
	game.data.player.body.setVelocity(0, 0);
	},

	stopBuying: function(){
		this.buying = false;
		me.state.resume(me.state.PLAY);
		game.data.player.body.setVelocity(game.data.playerMoveSpeed, 20);
		me.game.world.removeChild(game.data.buyscreen);
	}
});
{'fraction_non_alphanumeric': 0.18704418704418704, 'fraction_numerical': 0.018876018876018877, 'mean_word_length': 3.898109243697479, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5971567', 'n_tokens_mistral': 1956, 'n_tokens_neox': 1753, 'n_words': 321}