fixed problems with first world update

This commit is contained in:
jeena 2013-12-25 04:35:51 +01:00
parent 283a1ef48b
commit 93e8133c89
13 changed files with 353 additions and 166 deletions

View file

@ -0,0 +1,53 @@
define([
"Game/Core/GameObjects/Item",
"Game/Config/Settings",
"Game/Core/NotificationCenter"
],
function (Parent, Settings, NotificationCenter) {
function Item(physicsEngine, uid, options) {
Parent.call(this, physicsEngine, uid, options);
}
Item.prototype = Object.create(Parent.prototype);
Item.prototype.createMesh = function() {
var self = this;
var texturePath = Settings.GRAPHICS_PATH
+ Settings.GRAPHICS_SUBPATH_ITEMS
+ this.options.category + '/'
+ this.options.image;
var callback = function(mesh) {
self.mesh = mesh;
NotificationCenter.trigger("view/addMesh", mesh);
}
NotificationCenter.trigger("view/createMesh",
texturePath,
callback,
{
width: this.options.width,
height: this.options.height,
pivot: "mb"
}
);
};
Item.prototype.render = function() {
NotificationCenter.trigger("view/updateMesh",
this.mesh,
{
x: this.body.GetPosition().x * Settings.RATIO,
y: this.body.GetPosition().y * Settings.RATIO,
rotation: this.body.GetAngle()
}
);
}
return Item;
});

View file

@ -15,10 +15,9 @@ function (Parent, Settings, NotificationCenter) {
Tile.prototype.createMesh = function() {
var self = this;
var material = "Stones";
var texturePath = Settings.GRAPHICS_PATH
+ Settings.GRAPHICS_SUBPATH_TILES
+ material + '/'
+ this.options.m + '/'
+ this.options.s + ''
+ (this.options.r || 0) + '.gif';