<commit_before>/*jslint sloppy: true, plusplus: true, browser: true */
/*globals Vectr */

Vectr.GameObject = function (x, y) {
    this.position = {
        'x': x || 0,
        'y': y || 0
    };

    this.active = true;
    this.scale = 1;
    this.rotation = 0;
    this.glow = 0;
    this.colors = {
        'red': 255,
        'green': 255,
        'blue': 255,
        'alpha': 1
    };
    this.children = [];
    this.i = 0;
};


/**
 * @description Draw child objects
 * @param {CanvasRenderingContext2D} context
 */
Vectr.GameObject.prototype.draw = function (context, offsetX, offsetY) {
    if (this.active === false) {
        return;
    }

    if (offsetX === undefined) {
        offsetX = 0;
    }

    if (offsetY === undefined) {
        offsetY = 0;
    }

    this.i = this.children.length;
    while (this.i--) {
        this.children[this.i].draw(context, offsetX - this.position.x, offsetY - this.position.y);
    }
};

/**
 * @description Update all child objects
 * @param {Number} delta Time since last update (in seconds)
 */
Vectr.GameObject.prototype.update = function (delta) {
    if (this.active === false) {
        return;
    }

    this.i = this.children.length;
    while (this.i--) {
        this.children[this.i].update(delta);
    }
};

/**
 * @description Add an object to the draw/update loop<commit_msg>Correct usage of offset in GameObj<commit_after>/*jslint sloppy: true, plusplus: true, browser: true */
/*globals Vectr */

Vectr.GameObject = function (x, y) {
    this.position = {
        'x': x || 0,
        'y': y || 0
    };

    this.active = true;
    this.scale = 1;
    this.rotation = 0;
    this.glow = 0;
    this.colors = {
        'red': 255,
        'green': 255,
        'blue': 255,
        'alpha': 1
    };
    this.children = [];
    this.i = 0;
};


/**
 * @description Draw child objects
 * @param {CanvasRenderingContext2D} context
 */
Vectr.GameObject.prototype.draw = function (context, offsetX, offsetY) {
    if (this.active === false) {
        return;
    }

    offsetX = offsetX || 0;
    offsetY = offsetY || 0;

    this.i = this.children.length;
    while (this.i--) {
        this.children[this.i].draw(context, offsetX, offsetY);
    }
};

/**
 * @description Update all child objects
 * @param {Number} delta Time since last update (in seconds)
 */
Vectr.GameObject.prototype.update = function (delta) {
    if (this.active === false) {
        return;
    }

    this.i = this.children.length;
    while (this.i--) {
        this.children[this.i].update(delta);
    }
};

/**
 * @description Add an object to the draw/update loop
{'fraction_non_alphanumeric': 0.15749235474006115, 'fraction_numerical': 0.01452599388379205, 'mean_word_length': 2.211042944785276, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2601715', 'n_tokens_mistral': 919, 'n_tokens_neox': 874, 'n_words': 216}