-
-
Notifications
You must be signed in to change notification settings - Fork 642
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1008] me.CollectableEntity and me.LevelEntity are now deprecated an…
…d replaced respectively by more generic me.Collectable and me.Trigger objects that do not extend me.Entity anymore only remaining item now is to properly deprecate me.Entity. but for this version it's only gonna be a warning with no built-in replacement like here.
- Loading branch information
Showing
7 changed files
with
223 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Sprite from "./sprite.js"; | ||
import Body from "./../physics/body.js"; | ||
import collision from "./../physics/collision.js"; | ||
|
||
/** | ||
* a basic collectable helper class for immovable object (e.g. a coin) | ||
* @class | ||
* @extends me.Sprite | ||
* @memberOf me | ||
* @constructor | ||
* @param {Number} x the x coordinates of the collectable | ||
* @param {Number} y the y coordinates of the collectable | ||
* @param {Object} settings See {@link me.Sprite} | ||
*/ | ||
var Collectable = Sprite.extend({ | ||
/** | ||
* @ignore | ||
*/ | ||
init : function (x, y, settings) { | ||
// call the super constructor | ||
this._super(Sprite, "init", [x, y, settings]); | ||
|
||
this.name = settings.name; | ||
this.type = settings.type; | ||
this.id = settings.id; | ||
|
||
// add and configure the physic body | ||
this.body = new Body(this, settings.shapes || this.getBounds()); | ||
this.body.collisionType = collision.types.COLLECTABLE_OBJECT; | ||
|
||
// Update anchorPoint | ||
if (settings.anchorPoint) { | ||
this.anchorPoint.set(settings.anchorPoint.x, settings.anchorPoint.y); | ||
} else { | ||
// for backward compatibility | ||
this.anchorPoint.set(0, 0); | ||
} | ||
|
||
} | ||
}); | ||
|
||
export default Collectable; |
Oops, something went wrong.