<commit_before>'use strict';

var game = require('../game'),
    Phaser = require('phaser').Phaser;

var sprite;
var controls = {};
var testMap;
var puker = 1;
var jumper = 0;

function createGameState() {
        game.physics.startSystem(Phaser.Physics.ARCADE);
    testMap = game.add.tilemap('testMap');
    testMap.addTilesetImage('tilemaptest', 'testTiles');
    var layer = testMap.createLayer('Tile Layer 1');

    sprite = game.add.sprite(200, 200, 'test1');
    sprite.anchor.setTo(0.5, 0.5);
    sprite.scale.setTo(2, 4);

    game.physics.arcade.enable(sprite);
    //sprite.body.collideWorldBounds = true;
    game.physics.arcade.gravity.y = 300;

    game.physics.arcade.collide(sprite, layer);
    testMap.setCollisionBetween(0, 35);//kjjj

    sprite.body.maxVelocity.x = 400;
    sprite.body.drag.x = 370;
    sprite.body.drag.y = 370;
    sprite.running = false;
    game.physics.enable(sprite, Phaser.Physics.ARCADE);
    sprite.body.gravity.y = 1000;



    controls.left = game.input.keyboard.addKey(Phaser.Keyboard.LEFT);
    controls.right = game.input.keyboard.addKey(Phaser.Keyboard.RIGHT);
    controls.run = game.input.keyboard.addKey(Phaser.Keyboard.X);
    controls.jump = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
}

function updateGameState() {
    if (!sprite.running && controls.run.isDown) {
        sprite.running = true;
        sprite.body.maxVelocity.x = 700;
        sprite.body.drag.x = 470;
    }
    if (!controls.run.isDown && sprite.running) {
        sprite.running = false;
        sprite.body.maxVelocity.x = 400;
        sprite.body.drag.x = 370;
    }

    if (controls.left.isDown) {
        sprite.body.velocity.x -= 50;
    }
    if (controls.right.isDown) {
        sprite.body.velocity.x += 50;
    }
    if(jumper > 0) {jumper--;}
    if(sprite.y >= 500 && controls.jump.isDown && jumper == 0){
       jumper = 20;
       sprite.body.velocity.y = -500;
       if(sprite.running){
           sprite.body.velocity.y -= 100;
       }
       puker++;
    }
    else if (controls.jump.isDown && sprite.body.velocity.y < -300){
        sprite.body.velocity.y -= 20;
    }
    if(puker % 3 == 0){
       puke();
    }
}
function puke(){
     //sprite.body.velocity.y = 0;
}

var gameState = {
    create: createGameState,
    update: updateGameState
};

module.exports = gameState;
<commit_msg>JUMPING OFF OF TILES<commit_after>'use strict';

var game = require('../game'),
    Phaser = require('phaser').Phaser;

var sprite;
var controls = {};
var testMap;
var puker = 1;
var jumper = 0;
var layer;

function createGameState() {
        game.physics.startSystem(Phaser.Physics.ARCADE);
    testMap = game.add.tilemap('testMap');
    testMap.addTilesetImage('tilemaptest', 'testTiles');
    layer = testMap.createLayer('Tile Layer 1');

    sprite = game.add.sprite(200, 200, 'test1');
    sprite.anchor.setTo(0.5, 0.5);
    sprite.scale.setTo(2, 4);

    game.physics.arcade.enable(sprite);
    //sprite.body.collideWorldBounds = true;
    game.physics.arcade.gravity.y = 300;

    game.physics.arcade.collide(sprite, layer);
    testMap.setCollisionBetween(0, 35);//kjjj

    sprite.body.maxVelocity.x = 400;
    sprite.body.drag.x = 370;
    sprite.body.drag.y = 370;
    sprite.running = false;
    game.physics.enable(sprite, Phaser.Physics.ARCADE);
    sprite.body.gravity.y = 1000;



    controls.left = game.input.keyboard.addKey(Phaser.Keyboard.LEFT);
    controls.right = game.input.keyboard.addKey(Phaser.Keyboard.RIGHT);
    controls.run = game.input.keyboard.addKey(Phaser.Keyboard.X);
    controls.jump = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR);
}

function updateGameState() {
    game.physics.arcade.collide(sprite, layer);

    if (!sprite.running && controls.run.isDown) {
        sprite.running = true;
        sprite.body.maxVelocity.x = 700;
        sprite.body.drag.x = 470;
    }
    if (!controls.run.isDown && sprite.running) {
        sprite.running = false;
        sprite.body.maxVelocity.x = 400;
        sprite.body.drag.x = 370;
    }

    if (controls.left.isDown) {
        sprite.body.velocity.x -= 50;
    }
    if (controls.right.isDown) {
        sprite.body.velocity.x += 50;
    }
    if(jumper > 0) {jumper--;}
    if(sprite.body.onFloor() && controls.jump.isDown && jumper == 0){
       jumper = 20;
       sprite.body.velocity.y = -500;
       if(sprite.running){
           sprite.body.velocity.y -= 100;
       }
       puker++;
    }
    else if (controls.jump.isDown && sprite.body.velocity.y < -300){
        sprite.body.velocity.y -= 20;
    }
    if(puker % 3 == 0){
       puke();
    }
}
function puke(){
     //sprite.body.velocity.y = 0;
}

var gameState = {
    create: createGameState,
    update: updateGameState
};

module.exports = gameState;

{'fraction_non_alphanumeric': 0.1539912005028284, 'fraction_numerical': 0.0295411690760528, 'mean_word_length': 2.649847094801223, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '4518559', 'n_tokens_mistral': 1891, 'n_tokens_neox': 1721, 'n_words': 275}