<commit_before>enchant();
window.onload = function () {
    var game = new Game(window.screen.height, window.screen.width);
  
    game.keybind(32, 'a');
    game.spriteSheetWidth = 512;
    game.spriteSheetHeight = 32;
    game.itemSpriteSheetWidth = 128; 
    game.preload(['../img/items.png', '../img/sprites.png']); 
    game.items = [{ price: 1000, decription: 'Hurter', id: 0},
        {price: 5000, decription: 'Drg. Paw', id: 1 },
        {price: 5000, decription: 'Ice Magic', id: 2},
        {price: 60, decription: 'Chess Set', id: 3}];
    game.fps = 15;
    game.spriteWidth = 32;
    game.spriteHeight = 32;
    game.scale = 1.0;

    var map = new Map(game.spriteWidth, game.spriteHeight);
    var foregroundMap = new Map(game.spriteWidth, game.spriteHeight);
 
    var setMaps = function() {
        map.image = game.assets['../img/sprites.png'];
        map.loadData(mapData);
        foregroundMap.image = game.assets['../img/sprites.png'];
        foregroundMap.loadData(foregroundData);
        var collisionData = [];
        
        for(var i = 0; i < foregroundData.length; i++ ) {
            collisionData.push([]);
            for(var j = 0; j < foregroundData[0].length; j++){
                var collision = foregroundData[i][j] % 13 > 1 ? 1 : 0;
                collisionData[i][j] = collision;
            }
        }
        map.collisionData = collisionData;
    };

    var setStage = function(){
        var stage = new Group();
        stage.addChild(map);
        stage.addChild(player);

        var pad = new enchant.ui.Pad();
        pad.moveTo(0, 650);
        stage.addChild(pad);

        var buttonB = new enchant.ui.Button('B', 'light');
        buttonB.moveTo(180,710);
        game.currentScene.addChild(buttonB);

        var buttonA = new enchant.ui.Button('A', 'blue');
        buttonA.moveTo(230,710);
        game.currentScene.addChild(buttonA);
    
        buttonA.ontouchstart = function() {
            var playerFacing = player.facing();

            if (!playerFacing || !spriteRoles[playerFacing]) {
                player.displayStatus();
            } else {
                spriteRoles[playerFacing].action();
            }
        };

        stage.addChild(foregroundMap);
        stage.addChild(player.statusLabel);
        game.rootScene.addChild(stage);
    };

    var player = new Sprite(game.spriteWidth, game.spriteHeight);

    var setPlayer = function(){
        player.spriteOffset = 5;
        player.startingX = 6;
        player.startingY = 14;
        player.x = player.startingX * game.spriteWidth;
        player.y = player.startingY * game.spriteHeight;
        player.direction = 0;
        player.walk = 0;
        player.frame = player.spriteOffset + player.direction;
        player.image = new Surface(game.spriteSheetWidth, game.spriteSheetHeight);
        player.image.draw(game.assets['../img/sprites.png']);

        player.name = 'Steve';
        player.characterClass = 'Knight';
        player.exp = 0;
        player.level = 1;
        player.gp = 100;
        player.inventory = [];

        player.levelStats = [{}, { attack: 4, maxHp: 10, maxMp: 0, expMax: 10},
                             { attack: 6, maxHp: 14, maxMp: 0, expMax: 30},
                             { attack: 7, maxHp: 20, maxMp: 5, expMax: 50}
        ];
        
        player.attack = function() {
            return player.levelStats[player.level].attack;
        };

        player.hp = player.levelStats[player.level].maxHp;
        player.mp = player.levelStats[player.level].maxMp;

        player.statusLabel = new Label('');
        player.statusLabel.width = game.width;
        player.statusLabel.y = undefined;
        player.statusLabel.x = undefined;
        player.statusLabel.color = '#fff';
        player.statusLabel.backgroundColor = '#000';
    };

    player.displayStatus = function()
    {
        player.statusLabel.text = 
            '--' + player.name + ' the ' + player.characterClass +
            '<br />--HP: ' + player.hp + '/' + player.levelStats[player.level].maxHp +
            '<br />--MP: ' + player.mp + '/' + player.levelStats[player.level].maxMp +  
            '<br />--Exp: ' + player.exp +
            '<br />--Level: ' + player.level +
            '<br />--GP: ' + player.gp +
            '<br /><br />--Inventory:';
        player.statusLabel.height = 210;
        player.showInventory(0);   
    };

    player.clearStatus = function(){
        player.statusLabel.text = '';
        player.statusLabel.height = 0;
        player.hideInventory();
    };

    player.move = function() {
        this.frame = this.spriteOffset + this.direction * 2 + this.walk;

        if(this.isMoving){
            this.moveBy(this.xMovement, this.yMovement);
            if(!(game.frame % 2)){
                this.walk++;<commit_msg>fixing up erroer<commit_after>enchant();
window.onload = function () {
    var game = new Game(window.screen.height, window.screen.width);
  
    game.keybind(32, 'a');
    game.spriteSheetWidth = 512;
    game.spriteSheetHeight = 32;
    game.itemSpriteSheetWidth = 128; 
    game.preload(['../img/items.png', '../img/sprites.png']); 
    game.items = [{ price: 1000, decription: 'Hurter', id: 0},
        {price: 5000, decription: 'Drg. Paw', id: 1 },
        {price: 5000, decription: 'Ice Magic', id: 2},
        {price: 60, decription: 'Chess Set', id: 3}];
    game.fps = 15;
    game.spriteWidth = 32;
    game.spriteHeight = 32;
    game.scale = 1.0;

    var map = new Map(game.spriteWidth, game.spriteHeight);
    var foregroundMap = new Map(game.spriteWidth, game.spriteHeight);
 
    var setMaps = function() {
        map.image = game.assets['../img/sprites.png'];
        map.loadData(mapData);
        foregroundMap.image = game.assets['../img/sprites.png'];
        foregroundMap.loadData(foregroundData);
        var collisionData = [];
        
        for(var i = 0; i < foregroundData.length; i++ ) {
            collisionData.push([]);
            for(var j = 0; j < foregroundData[0].length; j++){
                var collision = foregroundData[i][j] % 13 > 1 ? 1 : 0;
                collisionData[i][j] = collision;
            }
        }
        map.collisionData = collisionData;
    };

    var setStage = function(){
        var stage = new Group();
        stage.addChild(map);
        stage.addChild(player);

        var pad = new enchant.ui.Pad();
        pad.moveTo(0, 650);
        stage.addChild(pad);

        var buttonB = new enchant.ui.Button('B', 'light');
        buttonB.moveTo(180,710);
        game.currentScene.addChild(buttonB);

        var buttonA = new enchant.ui.Button('A', 'blue');
        buttonA.moveTo(230,710);
        game.currentScene.addChild(buttonA);
    
        buttonA.ontouchstart = function() {
            var playerFacing = player.facing();

            if (!playerFacing || !spriteRoles[playerFacing]) {
                player.displayStatus();
            } else {
                spriteRoles[playerFacing].action();
            }
        };

        stage.addChild(foregroundMap);
        stage.addChild(player.statusLabel);
        game.rootScene.addChild(stage);
    };

    var player = new Sprite(game.spriteWidth, game.spriteHeight);

    var setPlayer = function(){
        player.spriteOffset = 5;
        player.startingX = 6;
        player.startingY = 14;
        player.x = player.startingX * game.spriteWidth;
        player.y = player.startingY * game.spriteHeight;
        player.direction = 0;
        player.walk = 0;
        player.frame = player.spriteOffset + player.direction;
        player.image = new Surface(game.spriteSheetWidth, game.spriteSheetHeight);
        player.image.draw(game.assets['../img/sprites.png']);

        player.name = 'Steve';
        player.characterClass = 'Knight';
        player.exp = 0;
        player.level = 1;
        player.gp = 100;
        player.inventory = [];

        player.levelStats = [{}, { attack: 4, maxHp: 10, maxMp: 0, expMax: 10},
                             { attack: 6, maxHp: 14, maxMp: 0, expMax: 30},
                             { attack: 7, maxHp: 20, maxMp: 5, expMax: 50}
        ];
        
        player.attack = function() {
            return player.levelStats[player.level].attack;
        };

        player.hp = player.levelStats[player.level].maxHp;
        player.mp = player.levelStats[player.level].maxMp;

        player.statusLabel = new Label('');
        player.statusLabel.width = game.width;
        player.statusLabel.y = undefined;
        player.statusLabel.x = undefined;
        player.statusLabel.color = '#fff';
        player.statusLabel.backgroundColor = '#000';
    };

    player.displayStatus = function()
    {
        player.statusLabel.text = 
            '--' + player.name + ' the ' + player.characterClass +
            '<br />--HP: ' + player.hp + '/' + player.levelStats[player.level].maxHp +
            '<br />--MP: ' + player.mp + '/' + player.levelStats[player.level].maxMp +  
            '<br />--Atk: ' + player.levelStats[player.level].attack +
            '<br />--Exp: ' + player.exp +
            '<br />--Level: ' + player.level +
            '<br />--GP: ' + player.gp +
            '<br /><br />--Inventory:';
        player.statusLabel.height = 210;
        player.showInventory(0);   
    };

    player.clearStatus = function(){
        player.statusLabel.text = '';
        player.statusLabel.height = 0;
        player.hideInventory();
    };

    player.move = function() {
        this.frame = this.spriteOffset + this.direction * 2 + this.walk;

        if(this.isMoving){
            this.moveBy(this.xMovement, this.yMovement);
            if(!(game.frame % 2)){
                this.walk++;
{'fraction_non_alphanumeric': 0.14797699733004724, 'fraction_numerical': 0.02033271719038817, 'mean_word_length': 1.9810223446587083, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 20, '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': '5477927', 'n_tokens_mistral': 3219, 'n_tokens_neox': 2972, 'n_words': 564}