<commit_before>cc.Class({
    extends: cc.Component,

    properties: {
    	player: {
    		default: null,
    		type: cc.Sprite
    	},

    	background: {
    		default: null,
    		type: cc.Node
    	}
 
    },

    // use this for initialization
    onLoad: function () {


    },

    // called every frame, uncomment this function to activate update callback
    update: function (dt) {
    	let moveBackground = this.player.getComponent('PlayerScript').moveBackground;
    	moveBackground !== 0 && this.background.getComponent('BackgroundScript').moveBackgroundChildren(moveBackground, dt);
    },
});<commit_msg>implement winGame functionality<commit_after>cc.Class({
    extends: cc.Component,

    properties: {
    	player: {
    		default: null,
    		type: cc.Sprite
    	},

    	background: {
    		default: null,
    		type: cc.Node
    	},
        winLoseLabel: {
            default: null,
            type: cc.Label
        },
        winDistance: 0
    },

    // use this for initialization
    onLoad: function () {
        this.wonFlag = false;
        this.wonPositionX = 0;
    },

    // called every frame, uncomment this function to activate update callback
    update: function (dt) {
    	let moveBackground = this.player.getComponent('PlayerScript').moveBackground;
        if (moveBackground !== 0) {
            this.background.getComponent('BackgroundScript').moveBackgroundChildren(moveBackground, dt);
        }
        
        let floor = this.background.getChildByName('Floor')
        // winGameMessage is, at the moment, called, when the player reaches a certain point in the world
        // this, of course, has to be replaced by a better way to check, whether the player has won (all enemies dead for example)
        if (floor.x < -500 && !this.wonFlag) {
            this.wonFlag = true;
            this.wonPositionX = floor.x;
            this.winGameMessage();
        } else if (this.wonFlag) {
            this.winGame(floor.x, this.wonPositionX)
        }
    },

    winGameMessage: function () {
        this.winLoseLabel.string = 'You Won! Continue to the right for the next Stage >>>';
    },
    winGame: function (floorX, wonPositionX) {
        if (floorX < wonPositionX - this.winDistance) {
            this.wonFlag = false;
            // this loadScene has to load the next stage
            cc.director.loadScene('01startMenu')
        }
    }
});
{'fraction_non_alphanumeric': 0.10613598673300166, 'fraction_numerical': 0.0037313432835820895, 'mean_word_length': 2.1666666666666665, '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': '6880453', 'n_tokens_mistral': 695, 'n_tokens_neox': 678, 'n_words': 182}