mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
added player arrow to me fixes #76
This commit is contained in:
parent
8f2cf11e38
commit
a58beb58d1
5 changed files with 92 additions and 3 deletions
|
|
@ -1,9 +1,10 @@
|
|||
define([
|
||||
"Game/Client/Player",
|
||||
"Game/Config/Settings"
|
||||
"Game/Config/Settings",
|
||||
"Lib/Utilities/NotificationCenter"
|
||||
],
|
||||
|
||||
function (Parent, Settings) {
|
||||
function (Parent, Settings, Nc) {
|
||||
|
||||
function Me(id, physicsEngine, user) {
|
||||
Parent.call(this, id, physicsEngine, user);
|
||||
|
|
@ -14,6 +15,9 @@ function (Parent, Settings) {
|
|||
y: 0
|
||||
}
|
||||
};
|
||||
|
||||
this.arrowMesh = null;
|
||||
this.createAndAddArrow();
|
||||
}
|
||||
|
||||
Me.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -61,6 +65,34 @@ function (Parent, Settings) {
|
|||
this.doll.body.SetLinearVelocity(options.lv);
|
||||
};
|
||||
|
||||
Me.prototype.createAndAddArrow = function(visible) {
|
||||
var self = this;
|
||||
|
||||
var position = this.getPosition();
|
||||
|
||||
var options = {
|
||||
x: position.x * Settings.RATIO,
|
||||
y: position.y * Settings.RATIO,
|
||||
};
|
||||
|
||||
var callback = function(arrowMesh) {
|
||||
self.arrowMesh = arrowMesh;
|
||||
}
|
||||
Nc.trigger(Nc.ns.client.view.playerArrow.createAndAdd, callback, options);
|
||||
};
|
||||
|
||||
Me.prototype.render = function() {
|
||||
|
||||
Parent.prototype.render.call(this);
|
||||
|
||||
var position = this.getPosition();
|
||||
var options = {
|
||||
x: position.x * Settings.RATIO,
|
||||
y: position.y * Settings.RATIO,
|
||||
}
|
||||
Nc.trigger(Nc.ns.client.view.playerArrow.update, this.arrowMesh, options);
|
||||
};
|
||||
|
||||
return Me;
|
||||
|
||||
});
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue