<commit_before>
var game = new Phaser.Game(960, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
var cat;
var fence;
var trash;

function preload() {
	game.stage.backgroundColor = "#ffffff";
	game.load.spritesheet('gato', 'assets/gato.png', 154, 81, 4);
	game.load.spritesheet('lata', 'assets/lixeiras.png', 111, 173, 1);
	game.load.image('cerca', 'assets/muro_842-131.png');
}

function create() {
	cat   = game.add.sprite(40,284,'gato');
	fence = game.add.tileSprite(100, 350, 842, 131,'cerca');
	trash = game.add.sprite(1100, 320,'lata');
	
	//trash = game.add.sprite(40,284,'lata');
	cat.animations.add('run');
	//cat.animations.add('lata');
	cat.animations.play('run', 10, true);
	
}

function update() {
	fence.tilePosition.x -= 5;
	trash.x -=5;
}<commit_msg>obstaculos<commit_after>
var game = new Phaser.Game(960, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });
var cat;
var fence;
var trash;
var cursors;
var gameOver;
var box;
var trashes;

function preload() {
	game.stage.backgroundColor = "#ffffff";
	game.load.image('fundo', 'assets/fundo_960-600.png');
	game.load.image('caixa', 'assets/caixas_180-173.png');
	game.load.spritesheet('gato', 'assets/gato_154-81-4.png', 154, 81, 4);
	game.load.image('lata', 'assets/lixeira_111-173.png');
	game.load.image('cerca', 'assets/muro_842-131.png');
}

function create() {
	game.add.sprite(0, 0, 'fundo');
	// Checar se precisa por fisica no ambiente
	game.physics.startSystem(Phaser.Physics.ARCADE);
	gameOver = false;
	cat   = game.add.sprite(140,284,'gato');
	game.physics.enable(cat, Phaser.Physics.ARCADE);
	
	cat.animations.add('run');
	cat.animations.play('run', 12, true);
	cat.body.collideWorldBounds = true;
	
	fence = game.add.tileSprite(0, 350, 842, 131,'cerca');

	cursors = game.input.keyboard.createCursorKeys();
	
//	createObstacle();
    game.time.events.repeat(Phaser.Timer.SECOND * 1.4, 100, createObstacle, this);

}

function createObstacle() {
//	var teste = game.add.sprite(300+(Math.random()*1000), 120 + Math.random() * 200,'lata');
//	game.physics.enable(teste, Phaser.Physics.ARCADE);

//	teste.body.collideWorldBounds = true;
//	teste.body.velocity.x = -300;
	//teste.body.immovable = true;
    //trashses.create(1100, 320, 'lata');
	//trashes.add(teste);

//	trashes.create(300+(Math.random()*500), 120 + Math.random() * 200,'lata');
	if(Math.random() < 0.5) {
		trash = game.add.sprite(1000+(Math.random()*300), 320,'lata');
		game.physics.enable(trash, Phaser.Physics.ARCADE);
		trash.body.velocity.x = -330;
	} else {
		box = game.add.sprite(1000+(Math.random()*300), 320,'caixa');
		game.physics.enable(box, Phaser.Physics.ARCADE);
		box.body.velocity.x = -330;
	
	}
	
}

function update() {
	fence.tilePosition.x -= 5;
//	trash.x -=5;

	//game.physics.arcade.overlap(cat, trash, gameOver, null, this);
	//game.physics.arcade.collide(cat, trash);
	//game.physics.arcade.collide(cat, trash, gameOver, null, this);
	game.physics.arcade.collide(trash, cat, collisionHandler, null, this);
	 
    if (cursors.up.isDown) {
        cat.y -= 20;
    } 

}

function collisionHandler (obj1, obj2) {
    game.stage.backgroundColor = '#992d2d';
}



{'fraction_non_alphanumeric': 0.19427148194271482, 'fraction_numerical': 0.06164383561643835, 'mean_word_length': 4.372909698996655, 'pattern_counts': {'":': 0, '<': 4, '<?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': '5868095', 'n_tokens_mistral': 1455, 'n_tokens_neox': 1272, 'n_words': 218}