mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
implemented gameobject for tiles and doll
This commit is contained in:
parent
fe0d4a66e2
commit
d51c705c1c
15 changed files with 221 additions and 326 deletions
|
|
@ -1,9 +1,52 @@
|
|||
define([
|
||||
"Game/Core/Physics/Doll"
|
||||
"Game/Core/Physics/Doll",
|
||||
"Game/Config/Settings",
|
||||
"Game/Core/NotificationCenter"
|
||||
],
|
||||
|
||||
function(Parent) {
|
||||
function (Parent, Settings, NotificationCenter) {
|
||||
|
||||
return Parent;
|
||||
function Doll(physicsEngine, playerId) {
|
||||
Parent.call(this, physicsEngine, playerId);
|
||||
this.height = 36;
|
||||
}
|
||||
|
||||
Doll.prototype = Object.create(Parent.prototype);
|
||||
|
||||
Doll.prototype.createMesh = function() {
|
||||
var self = this;
|
||||
|
||||
var imgPath = Settings.GRAPHICS_PATH
|
||||
+ Settings.GRAPHICS_SUBPATH_CHARACTERS
|
||||
+ 'Chuck' + '/'
|
||||
+ 'chuck.png';
|
||||
|
||||
var callback = function(mesh) {
|
||||
self.mesh = mesh;
|
||||
NotificationCenter.trigger("view/addMesh", mesh);
|
||||
}
|
||||
|
||||
NotificationCenter.trigger("view/createMesh",
|
||||
10,
|
||||
36,
|
||||
0,
|
||||
0,
|
||||
imgPath,
|
||||
callback
|
||||
);
|
||||
};
|
||||
|
||||
Doll.prototype.render = function() {
|
||||
|
||||
NotificationCenter.trigger("view/updateMesh",
|
||||
this.mesh,
|
||||
{
|
||||
x: this.body.GetPosition().x * Settings.RATIO + 4,
|
||||
y: (this.body.GetPosition().y * Settings.RATIO) - 29
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return Doll;
|
||||
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue