<commit_before>/*global State, Config*/

State.GamePlay = function (game) {
	"use strict";
	this.game = game;
};
State.GamePlay.prototype = {
    
	preload: function () {
		var cursors;
		var playerX,playerY, fishXLeft,fishXRight, runY;
		var fishes, lastY,lastFish;
		var score, style,labelScore;
        var bar;//barra de tempo
		var overlap, initTap, showEnd;
        var labelLevel,levelText;//variaveis do level
        
	},
    
    
	create: function () {
		this.game.physics.startSystem(Phaser.Game.ARCADE);
		playerY = 400; playerX = 100;
		fishXLeft = 120; fishXRight = 300;
		runY = 40;
		lastFish = null;
		score = 0; style = { font: "30px Arial Bold", fill: "#ffffff", align: "center"};
		initTap = true;
		showEnd = false;
        
        levelText = "Level  0";
        
        
    	bg = this.game.add.sprite(0, 0, 'bg');

		this.player = this.game.add.sprite(playerX, playerY ,'player');
		this.game.physics.enable(this.player);
		this.player.animations.add('ticar',[0,1,0],30,false);
		this.player.body.setSize(this.player.width, 10, 0, 5);
		this.player.anchor.setTo(.5, .5);

		fishes = game.add.group();
		this.addFishes();

		
		cursors = this.game.input.keyboard.createCursorKeys();
		this.game.input.keyboard.start();
		this.ticou = false;
		labelScore = this.game.add.text(this.game.world.centerX, 200, score, style);
		labelScore.anchor.set(0.5, 0);        
        
        labelLevel = this.game.add.text(this.game.world.centerX,450, levelText,style);
        labelLevel.anchor.set(0.5,0);
        
        
        /*bar = game.add.graphics();//adicionando o grafico
    	bar.lineStyle(20, 0x33FF00);
    	bar.moveTo(100,30);
    	bar.lineTo(this.game.world.width-100, 30);
    	bar.endFill();*/

		decrementValue=0.001;//variavel responsavel pelo aumento ou decremento do tempo, valor inicial
    	countLevelText=0;//contador do level, é concatenado com o texto



    	bar = game.add.graphics(100,30);
  		bar.lineStyle(10, 0x33FF00);
  		bar.moveTo(0, 0);
  		bar.lineTo(this.game.world.width-200, 0);
    
  		bar.scale.x = 0.5;
    },

	update: function () {
		
		overlap = false;
		this.game.physics.arcade.overlap(this.player, fishes, this.ticar, null,this);

		labelScore.setText(score);
        
        
		if (cursors.left.isUp ) {
			this.leftUp = true;
		}
		if (cursors.right.isUp ) {
			this.rightUp = true;
		}		

		if(!overlap && !initTap || bar.scale.x ==0){
			if(!showEnd){
				this.game.input.keyboard.stop();
				this.end();
			}
		}else{
			if(initTap == false){
				bar.scale.x -= decrementValue;
				if(bar.scale.x <=0){
					bar.scale.x = 0;
				}
			}
		}

		if (cursors.left.isDown && this.leftUp) {		
			this.run();
			this.leftUp = false;
			this.changeSprite(-1);
			this.player.position.setTo(playerX,playerY);			
			this.player.animations.play('ticar');			
			ticou = true;
			initTap = false;
		}        
        
        else if(cursors.right.isDown && this.rightUp){
			this.run();
			this.rightUp = false;
			this.changeSprite(1);
			this.player.position.setTo(Config.global.screen.width-playerX,playerY);			
			this.player.animations.play('ticar');			
			ticou = true;
			initTap = false;
		}		
	},

	changeSprite: function(scale){
		this.player.scale.x = scale;
		this.player.scale.x = (-1)*scale;
	},
    
    upLevelTest:function(){
    	if(score%10==0){//testa o up de level seguindo o score do jogador
    		decrementValue *= 1.5;//valor aumentado em *1.5
    	}
    },    
    
	run: function(){
		lastY = 1000;
		fishes.forEach(function (f){ 
			f.y += runY;			
			if(f.y < lastY){
				lastY = f.y;
				lastFish = f;
			}<commit_msg>texto level<commit_after>/*global State, Config*/

State.GamePlay = function (game) {
	"use strict";
	this.game = game;
};
State.GamePlay.prototype = {
    
	preload: function () {
		var cursors;
		var playerX,playerY, fishXLeft,fishXRight, runY;
		var fishes, lastY,lastFish;
		var score, style,labelScore;
        var bar;//barra de tempo
		var overlap, initTap, showEnd;
        var labelLevel,levelText,countLevelText;//variaveis do level
        
	},
    
    
	create: function () {
		this.game.physics.startSystem(Phaser.Game.ARCADE);
		playerY = 400; playerX = 100;
		fishXLeft = 120; fishXRight = 300;
		runY = 40;
		lastFish = null;
		score = 0; style = { font: "30px Arial Bold", fill: "#ffffff", align: "center"};
		initTap = true;
		showEnd = false;
        
        levelText = "Level  0";
        
        
    	bg = this.game.add.sprite(0, 0, 'bg');

		this.player = this.game.add.sprite(playerX, playerY ,'player');
		this.game.physics.enable(this.player);
		this.player.animations.add('ticar',[0,1,0],30,false);
		this.player.body.setSize(this.player.width, 10, 0, 5);
		this.player.anchor.setTo(.5, .5);

		fishes = game.add.group();
		this.addFishes();

		
		cursors = this.game.input.keyboard.createCursorKeys();
		this.game.input.keyboard.start();
		this.ticou = false;
		labelScore = this.game.add.text(this.game.world.centerX, 200, score, style);
		labelScore.anchor.set(0.5, 0);        
        
        labelLevel = this.game.add.text(this.game.world.centerX,450, levelText,style);
        labelLevel.anchor.set(0.5,0);
        
        
        /*bar = game.add.graphics();//adicionando o grafico
    	bar.lineStyle(20, 0x33FF00);
    	bar.moveTo(100,30);
    	bar.lineTo(this.game.world.width-100, 30);
    	bar.endFill();*/

		decrementValue=0.001;//variavel responsavel pelo aumento ou decremento do tempo, valor inicial
    	countLevelText=0;//contador do level, é concatenado com o texto



    	bar = game.add.graphics(100,30);
  		bar.lineStyle(10, 0x33FF00);
  		bar.moveTo(0, 0);
  		bar.lineTo(this.game.world.width-200, 0);
    
  		bar.scale.x = 0.5;
    },

	update: function () {
		
		overlap = false;
		this.game.physics.arcade.overlap(this.player, fishes, this.ticar, null,this);

		labelScore.setText(score);
        
        
		if (cursors.left.isUp ) {
			this.leftUp = true;
		}
		if (cursors.right.isUp ) {
			this.rightUp = true;
		}		

		if(!overlap && !initTap || bar.scale.x ==0){
			if(!showEnd){
				this.game.input.keyboard.stop();
				this.end();
			}
		}else{
			if(initTap == false){
				bar.scale.x -= decrementValue;
				if(bar.scale.x <=0){
					bar.scale.x = 0;
				}
			}
		}

		if (cursors.left.isDown && this.leftUp) {		
			this.run();
			this.leftUp = false;
			this.changeSprite(-1);
			this.player.position.setTo(playerX,playerY);			
			this.player.animations.play('ticar');			
			ticou = true;
			initTap = false;
		}        
        
        else if(cursors.right.isDown && this.rightUp){
			this.run();
			this.rightUp = false;
			this.changeSprite(1);
			this.player.position.setTo(Config.global.screen.width-playerX,playerY);			
			this.player.animations.play('ticar');			
			ticou = true;
			initTap = false;
		}		
	},

	changeSprite: function(scale){
		this.player.scale.x = scale;
		this.player.scale.x = (-1)*scale;
	},
    
    upLevelTest:function(){
    	if(score%10==0){//testa o up de level seguindo o score do jogador
    		decrementValue *= 1.07;//valor aumentado em *1.5
            labelLevel.setText("Level "+ ++countLevelText);
            
            
    	}
    },    
    
	run: function(){
		lastY = 1000;
		fishes.forEach(function (f){ 
			f.y += runY;			
			if(f.y < lastY){
				lastY = f.y;
				lastFish = f;
			}
{'fraction_non_alphanumeric': 0.15578026783274118, 'fraction_numerical': 0.02801311833834381, 'mean_word_length': 2.5702439024390245, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '3385496', 'n_tokens_mistral': 3186, 'n_tokens_neox': 2735, 'n_words': 479}