<commit_before>/**
 * Created by user on 1/12/14.
 */
(function () {
    var data;
    window.sprites = window.sprites || {};

    var SpriteMan = function (config) {
        this.config = config;
        this.playerTypes = ["player","hockey","football"];
        this.initialize();
        pl = this;
    }

    var p = SpriteMan.prototype = new createjs.Container;
    p.Sprite_initialize = p.initialize;

    p.initialize = function () {
        this.type = getRandomType(this);
        var id = this.type +"_normal";
        this.spriteData = new SpriteSheet({"id" : id, "data": PlayerData[id].data, "loader" : this.config.loader, "gameState": this.config.gameState});
        this.sprite = new createjs.Sprite(this.spriteData, "idle");
        this.extras = PlayerData[id].extras;
        this.setScale(this.extras.sX,this.extras.sY);
        this.setEffects(id);
        this.Sprite_initialize();
        this.addChild(this.sprite);
        this.hit = false;
        this.hitPowerup = false;
        this.life = 1;
        this.singleHit = false;
        this.hitEnemies = [];
        this.speed = this.config.speed || 6;



        this.bounds = this.getBounds();
        //this.setTransform(0,0,0.5,0.5);
    }
    var getRandomType = function(me){
        var type = Math.floor(Math.random() * me.playerTypes.length);
        return me.playerTypes[type];
    };

    var drawBorder = function(me){
        if(me.shape != undefined){
            me.removeChild(me.shape);
        }

        me.shape = new createjs.Shape();
        me.shape.graphics.beginStroke("#000").setStrokeStyle(0.5).drawRect(0,0,me.getWidth(), me.getHeight());
        me.addChild(me.shape);

    }

    SpriteMan.prototype.setDefaultSpriteSheet = function(){
        var id = this.type+"_normal";
        this.spriteData = new SpriteSheet({"id" : id, "data": PlayerData[id].data, "loader" : this.config.loader});
        this.sprite.spriteSheet = this.spriteData;
        this.extras = PlayerData[id].extras;
        this.setScale(this.extras.sX,this.extras.sY);
        this.sprite.gotoAndPlay("idle");

    }
    SpriteMan.prototype.setPowerupSpriteSheet = function(powerupType){
        var id = this.type+"_"+powerupType;
        this.spriteData = new SpriteSheet({"id" : id, "data": PlayerData[id].data, "loader" : this.config.loader});
        this.sprite.spriteSheet = this.spriteData;
        this.extras = PlayerData[id].extras;
        this.setScale(this.extras.sX,this.extras.sY);
        this.sprite.gotoAndPlay("idle");

    }
    
    window.sprites.SpriteMan = SpriteMan;
    SpriteMan.prototype.setEffects = function(id){
       // console.log("EFFECTS");
        this.config.playerSound = PlayerData[id].extras.sound;
    }
    SpriteMan.prototype.run  = function(){
        var me = this;
        //drawBorder(this);
        this.sprite.gotoAndPlay("run");
        this.myTick = function(){tick(me)};
        this.addEventListener("tick", this.myTick);
    }
    SpriteMan.prototype.addPowerups = function(power){
        this.life = power.life;
        this.singleHit = power.singleHit;
    }
    SpriteMan.prototype.pause = function(){
        this.removeEventListener("tick",  this.myTick);
        this.sprite.gotoAndPlay("idle");
    }

    SpriteMan.prototype.confused = function(){
        this.sprite.gotoAndPlay("confused");
    }
    SpriteMan.prototype.setPosition = function(x, y){
        this.x  = x;
        this.y = y;
        this.regX = 0;
        this.regY = this.getHeight();///2;

    }
    SpriteMan.prototype.setSpeed = function(speed){
        this.speed = speed;
        this.sprite._animation.speed = speed;
    }
    SpriteMan.prototype.kill = function(enemyLife){
        var me = this;
        for(var i=0;i<enemyLife;i++){
            if(this.life!=0){
                this.life -= 1;

            }
        }
        if(this.life!=0){
            this.tackle();
        }
        if(this.life == 0){
            this.hit = true;
            this.sprite.gotoAndPlay("tackle");
            var fileId = this.config.playerSound.tackle;
            EventBus.dispatch("playSound",fileId);
            this.myAnimationEnd = function(){
                removeFallingAnimation(me);
                EventBus.addEventListener("removeFromStage",me);
            };
            me.removeEventListener("tick",  this.myTick);
            this.sprite.addEventListener("animationend",this.myAnimationEnd);
            return 0;
        } 


    }
    SpriteMan.prototype.tackle = function(){
        var me  = this;
        this.sprite.gotoAndPlay("tackle");
        this.toRun = function(){
            me.sprite.removeEventListener("animationend",me.toRun);
            me.sprite.gotoAndPlay("run");
        };
        this.sprite.addEventListener("animationend",this.toRun);
    }
    SpriteMan.prototype.setEndPoint = function(endPointX){
        this.endPoint = endPointX;<commit_msg>Fixed the following issues: 1.During a level then the "Stadium Ambience" sound should be playing in the background. 2.sound effects missing from when certain enemies are tackled.<commit_after>/**
 * Created by user on 1/12/14.
 */
(function () {
    var data;
    window.sprites = window.sprites || {};

    var SpriteMan = function (config) {
        this.config = config;
        this.playerTypes = ["player","hockey","football"];
        this.initialize();
        pl = this;
    }

    var p = SpriteMan.prototype = new createjs.Container;
    p.Sprite_initialize = p.initialize;

    p.initialize = function () {
        this.type = getRandomType(this);
        var id = this.type +"_normal";
        this.spriteData = new SpriteSheet({"id" : id, "data": PlayerData[id].data, "loader" : this.config.loader, "gameState": this.config.gameState});
        this.sprite = new createjs.Sprite(this.spriteData, "idle");
        this.extras = PlayerData[id].extras;
        this.setScale(this.extras.sX,this.extras.sY);
        this.setEffects(id);
        this.Sprite_initialize();
        this.addChild(this.sprite);
        this.hit = false;
        this.hitPowerup = false;
        this.life = 1;
        this.singleHit = false;
        this.hitEnemies = [];
        this.speed = this.config.speed || 6;



        this.bounds = this.getBounds();
        //this.setTransform(0,0,0.5,0.5);
    }
    var getRandomType = function(me){
        var type = Math.floor(Math.random() * me.playerTypes.length);
        return me.playerTypes[type];
    };

    var drawBorder = function(me){
        if(me.shape != undefined){
            me.removeChild(me.shape);
        }

        me.shape = new createjs.Shape();
        me.shape.graphics.beginStroke("#000").setStrokeStyle(0.5).drawRect(0,0,me.getWidth(), me.getHeight());
        me.addChild(me.shape);

    }

    SpriteMan.prototype.setDefaultSpriteSheet = function(){
        var id = this.type+"_normal";
        this.spriteData = new SpriteSheet({"id" : id, "data": PlayerData[id].data, "loader" : this.config.loader});
        this.sprite.spriteSheet = this.spriteData;
        this.extras = PlayerData[id].extras;
        this.setScale(this.extras.sX,this.extras.sY);
        this.sprite.gotoAndPlay("idle");

    }
    SpriteMan.prototype.setPowerupSpriteSheet = function(powerupType){
        var id = this.type+"_"+powerupType;
        this.spriteData = new SpriteSheet({"id" : id, "data": PlayerData[id].data, "loader" : this.config.loader});
        this.sprite.spriteSheet = this.spriteData;
        this.extras = PlayerData[id].extras;
        this.setScale(this.extras.sX,this.extras.sY);
        this.sprite.gotoAndPlay("idle");

    }
    
    window.sprites.SpriteMan = SpriteMan;
    SpriteMan.prototype.setEffects = function(id){
       // console.log("EFFECTS");
        this.config.playerSound = PlayerData[id].extras.sound;
    }
    SpriteMan.prototype.run  = function(){
        var me = this;
        //drawBorder(this);
        this.sprite.gotoAndPlay("run");
        this.myTick = function(){tick(me)};
        this.addEventListener("tick", this.myTick);
    }
    SpriteMan.prototype.addPowerups = function(power){
        this.life = power.life;
        this.singleHit = power.singleHit;
    }
    SpriteMan.prototype.pause = function(){
        this.removeEventListener("tick",  this.myTick);
        this.sprite.gotoAndPlay("idle");
    }

    SpriteMan.prototype.confused = function(){
        this.sprite.gotoAndPlay("confused");
    }
    SpriteMan.prototype.setPosition = function(x, y){
        this.x  = x;
        this.y = y;
        this.regX = 0;
        this.regY = this.getHeight();///2;

    }
    SpriteMan.prototype.setSpeed = function(speed){
        this.speed = speed;
        this.sprite._animation.speed = speed;
    }
    SpriteMan.prototype.kill = function(enemyLife){
        var me = this;
        for(var i=0;i<enemyLife;i++){
            if(this.life!=0){
                this.life -= 1;

            }
        }
        if(this.life!=0){
            this.tackle();
        }
        if(this.life == 0){
            this.hit = true;
            this.sprite.gotoAndPlay("tackle");
            this.myAnimationEnd = function(){
                removeFallingAnimation(me);
                EventBus.addEventListener("removeFromStage",me);
            };
            me.removeEventListener("tick",  this.myTick);
            this.sprite.addEventListener("animationend",this.myAnimationEnd);
            return 0;
        } 


    }
    SpriteMan.prototype.tackle = function(){
        var me  = this;
        this.sprite.gotoAndPlay("tackle");
        this.toRun = function(){
            me.sprite.removeEventListener("animationend",me.toRun);
            me.sprite.gotoAndPlay("run");
        };
        this.sprite.addEventListener("animationend",this.toRun);
    }
    SpriteMan.prototype.setEndPoint = function(endPointX){
        this.endPoint = endPointX;
{'fraction_non_alphanumeric': 0.1427992297557515, 'fraction_numerical': 0.005878179791223269, 'mean_word_length': 2.2893333333333334, 'pattern_counts': {'":': 8, '<': 5, '<?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': '4866958', 'n_tokens_mistral': 3124, 'n_tokens_neox': 3074, 'n_words': 471}