<commit_before>/*
 * MelonJS Game Engine
 * Copyright (C) 2011 - 2013, <NAME>
 * http://www.melonjs.org
 *
 */

(function () {

    /**
     * me.ObjectSettings contains the object attributes defined in Tiled<br>
     * and is created by the engine and passed as parameter to the corresponding
     * object when loading a level<br>
     * the field marked Mandatory are to be defined either in Tiled, or in the
     * before calling the parent constructor<br>
     * <img src="images/object_properties.png"/><br>
     * @class
     * @protected
     * @memberOf me
     */
    me.ObjectSettings = {
        /**
         * object entity name<br>
         * as defined in the Tiled Object Properties
         * @public
         * @type String
         * @name name
         * @memberOf me.ObjectSettings
         */
        name : null,

        /**
         * image ressource name to be loaded<br>
         * MANDATORY<br>
         * (in case of TiledObject, this field is automatically set)
         * @public
         * @type String
         * @name image
         * @memberOf me.ObjectSettings
         */
        image : null,

        /**
         * specify a transparent color for the image in rgb format (#rrggbb)<br>
         * OPTIONAL<br>
         * (using this option will imply processing time on the image)
         * @public
         * @deprecated Use PNG or GIF with transparency instead
         * @type String
         * @name transparent_color
         * @memberOf me.ObjectSettings
         */
        transparent_color : null,

        /**
         * width of a single sprite in the spritesheet<br>
         * MANDATORY<br>
         * (in case of TiledObject, this field is automatically set)
         * @public
         * @type Int
         * @name spritewidth
         * @memberOf me.ObjectSettings
         */
        spritewidth : null,

        /**
         * height of a single sprite in the spritesheet<br>
         * OPTIONAL<br>
         * if not specified the value will be set to the corresponding image height<br>
         * (in case of TiledObject, this field is automatically set)
         * @public
         * @type Int
         * @name spriteheight
         * @memberOf me.ObjectSettings
         */
        spriteheight : null,

        /**
         * custom type for collision detection<br>
         * OPTIONAL
         * @public
         * @type String
         * @name type
         * @memberOf me.ObjectSettings
         */
        type : 0,

        /**
         * Enable collision detection for this object<br>
         * OPTIONAL
         * @public
         * @type Boolean
         * @name collidable
         * @memberOf me.ObjectSettings
         */
        collidable : true
    };

    /*
     * A generic object entity
     */

    /**
     * a Generic Object Entity<br>
     * Object Properties (settings) are to be defined in Tiled, <br>
     * or when calling the parent constructor
     *
     * @class
     * @extends me.Renderable
     * @memberOf me
     * @constructor
     * @param {Number} x the x coordinates of the sprite object
     * @param {Number} y the y coordinates of the sprite object
     * @param {me.ObjectSettings} settings Object Properties as defined in Tiled<br>
     * <img src="images/object_properties.png"/>
     */
    me.ObjectEntity = me.Renderable.extend(
    /** @scope me.ObjectEntity.prototype */ {

        /**
         * define the type of the object<br>
         * default value : none<br>
         * @public
         * @type String
         * @name type
         * @memberOf me.ObjectEntity
         */
        type : 0,

        /**
         * flag to enable collision detection for this object<br>
         * default value : true<br>
         * @public
         * @type Boolean
         * @name collidable
         * @memberOf me.ObjectEntity
         */
        collidable : true,

        /**
         * The collision shapes of the entity <br>
         * (note: only shape at index 0 is used in melonJS 1.0.x)
         * @type {me.Rect[]|me.PolyShape[]|me.Ellipse[]}
         * @name shapes
         * @memberOf me.ObjectEntity
         */
        shapes : [],

        /**
         * The current shape index
         * @ignore
         * @type Number
         * @name shapeIndex
         * @memberOf me.ObjectEntity
         */
        shapeIndex : 0,

        /**
         * The entity renderable object (if defined)
         * @public
         * @type me.Renderable
         * @name renderable
         * @memberOf me.ObjectEntity
         */
        renderable : null,

        // just to keep track of when we flip
        lastflipX : false,
        lastflipY : false,

        /** @ignore */
        init : function (x, y, settings) {
            // call the parent constructor
            this.parent(
                this.pos.set(x, y),
                settings.width,
                settings.height
            );

            if (settings.image) {
                var image = (
                    typeof settings.image === "string" ?
                    me.loader.getImage(settings.image) : settings.image
                );
                this.renderable = new me.AnimationSheet(
                    0, 0, image,
                    ~~settings.spritewidth,
                    ~~settings.spriteheight,
                    ~~settings.spacing,
                    ~~settings.margin
                );

                // check for user defined transparent color
                if (settings.transparent_color) {<commit_msg>[#441] use the `width` and `height` properties if `spritewidth` and `spriteheight` are not defined<commit_after>/*
 * MelonJS Game Engine
 * Copyright (C) 2011 - 2013, <NAME>
 * http://www.melonjs.org
 *
 */

(function () {

    /**
     * me.ObjectSettings contains the object attributes defined in Tiled<br>
     * and is created by the engine and passed as parameter to the corresponding
     * object when loading a level<br>
     * the field marked Mandatory are to be defined either in Tiled, or in the
     * before calling the parent constructor<br>
     * <img src="images/object_properties.png"/><br>
     * @class
     * @protected
     * @memberOf me
     */
    me.ObjectSettings = {
        /**
         * object entity name<br>
         * as defined in the Tiled Object Properties
         * @public
         * @property {String} name
         * @memberOf me.ObjectSettings
         */
        name : null,

        /**
         * image ressource name to be loaded<br>
         * (in case of TiledObject, this field is automatically set)
         * @public
         * @property {String} image
         * @memberOf me.ObjectSettings
         */
        image : null,

        /**
         * specify a transparent color for the image in rgb format (#rrggbb)<br>
         * (using this option will imply processing time on the image)
         * @public
         * @deprecated Use PNG or GIF with transparency instead
         * @property {String=} transparent_color
         * @memberOf me.ObjectSettings
         */
        transparent_color : null,

        /**
         * width of a single sprite in the spritesheet<br>
         * (in case of TiledObject, this field is automatically set)
         * @public
         * @property {Number=} spritewidth
         * @memberOf me.ObjectSettings
         */
        spritewidth : null,

        /**
         * height of a single sprite in the spritesheet<br>
         * if not specified the value will be set to the corresponding image height<br>
         * (in case of TiledObject, this field is automatically set)
         * @public
         * @property {Number=} spriteheight
         * @memberOf me.ObjectSettings
         */
        spriteheight : null,

        /**
         * custom type for collision detection
         * @public
         * @property {String=} type
         * @memberOf me.ObjectSettings
         */
        type : 0,

        /**
         * Enable collision detection for this object<br>
         * @public
         * @property {Boolean=} collidable
         * @memberOf me.ObjectSettings
         */
        collidable : true
    };

    /*
     * A generic object entity
     */

    /**
     * a Generic Object Entity<br>
     * Object Properties (settings) are to be defined in Tiled, <br>
     * or when calling the parent constructor
     *
     * @class
     * @extends me.Renderable
     * @memberOf me
     * @constructor
     * @param {Number} x the x coordinates of the sprite object
     * @param {Number} y the y coordinates of the sprite object
     * @param {me.ObjectSettings} settings Object Properties as defined in Tiled<br>
     * <img src="images/object_properties.png"/>
     */
    me.ObjectEntity = me.Renderable.extend(
    /** @scope me.ObjectEntity.prototype */ {

        /**
         * define the type of the object<br>
         * default value : none<br>
         * @public
         * @type String
         * @name type
         * @memberOf me.ObjectEntity
         */
        type : 0,

        /**
         * flag to enable collision detection for this object<br>
         * default value : true<br>
         * @public
         * @type Boolean
         * @name collidable
         * @memberOf me.ObjectEntity
         */
        collidable : true,

        /**
         * The collision shapes of the entity <br>
         * (note: only shape at index 0 is used in melonJS 1.0.x)
         * @type {me.Rect[]|me.PolyShape[]|me.Ellipse[]}
         * @name shapes
         * @memberOf me.ObjectEntity
         */
        shapes : [],

        /**
         * The current shape index
         * @ignore
         * @type Number
         * @name shapeIndex
         * @memberOf me.ObjectEntity
         */
        shapeIndex : 0,

        /**
         * The entity renderable object (if defined)
         * @public
         * @type me.Renderable
         * @name renderable
         * @memberOf me.ObjectEntity
         */
        renderable : null,

        // just to keep track of when we flip
        lastflipX : false,
        lastflipY : false,

        /** @ignore */
        init : function (x, y, settings) {
            // call the parent constructor
            this.parent(
                this.pos.set(x, y),
                settings.width,
                settings.height
            );

            if (settings.image) {
                var image = (
                    typeof settings.image === "string" ?
                    me.loader.getImage(settings.image) : settings.image
                );
                this.renderable = new me.AnimationSheet(
                    0, 0, image,
                    ~~(settings.spritewidth || settings.width),
                    ~~(settings.spriteheight || settings.height),
                    ~~settings.spacing,
                    ~~settings.margin
                );

                // check for user defined transparent color
                if (settings.transparent_color) {
{'fraction_non_alphanumeric': 0.09380692167577413, 'fraction_numerical': 0.0031876138433515485, 'mean_word_length': 1.5065053640721298, 'pattern_counts': {'":': 0, '<': 52, '<?xml version=': 0, '>': 52, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5355386', 'n_tokens_mistral': 2958, 'n_tokens_neox': 2822, 'n_words': 910}